コード例 #1
0
ファイル: WrappedLabel.cs プロジェクト: jmfb/XComGenerations
 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;
 }
コード例 #2
0
ファイル: DynamicLabel.cs プロジェクト: jmfb/XComGenerations
        public DynamicLabel(
			int topRow,
			int leftColumn,
			Func<string> textAction,
			Font font,
			ColorScheme scheme)
            : base(topRow, leftColumn, textAction(), font, scheme)
        {
            this.textAction = textAction;
        }
コード例 #3
0
ファイル: ExtendedEdit.cs プロジェクト: jmfb/XComGenerations
        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)
        {
        }
コード例 #4
0
ファイル: ExtendedLabel.cs プロジェクト: jmfb/XComGenerations
        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;
        }
コード例 #5
0
ファイル: Toggle.cs プロジェクト: jmfb/XComGenerations
        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)
        {
        }
コード例 #6
0
ファイル: LabeledValue.cs プロジェクト: jmfb/XComGenerations
        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;
        }
コード例 #7
0
ファイル: Edit.cs プロジェクト: jmfb/XComGenerations
        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;
        }
コード例 #8
0
ファイル: WrappedLabel.cs プロジェクト: jmfb/XComGenerations
 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);
 }
コード例 #9
0
ファイル: Button.cs プロジェクト: jmfb/XComGenerations
        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;
        }