Esempio n. 1
0
 public WrappedLabel(int topRow, int leftColumn, int width, string text, Font font, ColorScheme scheme)
 {
     var nextTopRow = topRow;
     foreach (var lineOfText in WrapText(text, width, font))
     {
         AddControl(new Label(nextTopRow, leftColumn, lineOfText, font, scheme));
         nextTopRow += font.Height;
     }
     Bottom = nextTopRow;
 }
Esempio n. 2
0
        public DynamicLabel(
			int topRow,
			int leftColumn,
			Func<string> textAction,
			Font font,
			ColorScheme scheme)
            : base(topRow, leftColumn, textAction(), font, scheme)
        {
            this.textAction = textAction;
        }
Esempio n. 3
0
        public ExtendedEdit(
			int topRow,
			int leftColumn,
			int width,
			string text,
			Font font,
			ColorScheme scheme,
			Action<string> action)
            : base(topRow, leftColumn, width, text, font, scheme, action)
        {
        }
Esempio n. 4
0
        public ExtendedLabel(
			int topRow,
			int leftColumn,
			int width,
			string text,
			Font font,
			ColorScheme scheme)
            : base(topRow, leftColumn, text, font, scheme)
        {
            this.width = width;
            fillScheme = scheme;
        }
Esempio n. 5
0
        public Toggle(
			int topRow,
			int leftColumn,
			int width,
			int height,
			string text,
			ColorScheme scheme,
			Font font,
			Action action)
            : base(topRow, leftColumn, width, height, text, scheme, font, action)
        {
        }
Esempio n. 6
0
        public LabeledValue(
			int topRow,
			int leftColumn,
			string labelText,
			string valueText,
			Font font,
			ColorScheme labelScheme,
			ColorScheme valueScheme)
        {
            this.topRow = topRow;
            this.leftColumn = leftColumn;
            this.labelText = labelText;
            this.valueText = valueText;
            this.font = font;
            this.labelScheme = labelScheme;
            this.valueScheme = valueScheme;
        }
Esempio n. 7
0
        public Edit(
			int topRow,
			int leftColumn,
			int width,
			string text,
			Font font,
			ColorScheme scheme,
			Action<string> action)
        {
            TopRow = topRow;
            LeftColumn = leftColumn;
            Width = width;
            Text = text;
            Font = font;
            Scheme = scheme;
            this.action = action;
        }
Esempio n. 8
0
 private static IEnumerable<string> WrapText(string text, int width, Font font)
 {
     var wordsOnLine = new List<string>();
     foreach (var word in text.Split(' '))
     {
         var lineWithoutWord = string.Join(" ", wordsOnLine);
         wordsOnLine.Add(word);
         var lineWithWord = string.Join(" ", wordsOnLine);
         if (font.MeasureString(lineWithWord) <= width)
             continue;
         yield return lineWithoutWord;
         wordsOnLine.Clear();
         wordsOnLine.Add(word);
     }
     if (wordsOnLine.Any())
         yield return string.Join(" ", wordsOnLine);
 }
Esempio n. 9
0
        public Button(
			int topRow,
			int leftColumn,
			int width,
			int height,
			string text,
			ColorScheme scheme,
			Font font,
			Action action)
        {
            this.topRow = topRow;
            this.leftColumn = leftColumn;
            this.width = width;
            this.height = height;
            this.text = text;
            this.scheme = scheme;
            this.font = font;
            Action = action;
            Visible = true;
        }