private FlowLayoutWidget GetHelpTextWidget() { FlowLayoutWidget allText = new FlowLayoutWidget(FlowDirection.TopToBottom); double textRegionWidth = 260 * TextWidget.GlobalPointSizeScaleRatio; allText.Margin = new BorderDouble(3) * TextWidget.GlobalPointSizeScaleRatio; allText.Padding = new BorderDouble(3) * TextWidget.GlobalPointSizeScaleRatio; allText.HAnchor = HAnchor.ParentLeftRight; allText.BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay; double helpPointSize = 10; EnglishTextWrapping wrapper = new EnglishTextWrapping(helpPointSize); string[] wrappedText = wrapper.WrapText(HelpText, textRegionWidth - allText.Padding.Width); foreach (string line in wrappedText) { GuiWidget helpWidget = new TextWidget(line, pointSize: helpPointSize, textColor: RGBA_Bytes.White); allText.AddChild(helpWidget); } allText.MinimumSize = new Vector2(textRegionWidth, allText.MinimumSize.y); allText.Visible = false; return allText; }
private void AddInHelpText(FlowLayoutWidget topToBottomSettings, OrganizerSettingsData settingInfo) { FlowLayoutWidget allText = new FlowLayoutWidget(FlowDirection.TopToBottom); double textRegionWidth = 380; allText.Margin = new BorderDouble(3); allText.Padding = new BorderDouble(5); allText.BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay; double helpPointSize = 10; EnglishTextWrapping wrapper = new EnglishTextWrapping(helpPointSize); string[] wrappedText = wrapper.WrapText(settingInfo.HelpText, textRegionWidth - allText.Padding.Width); foreach (string line in wrappedText) { GuiWidget helpWidget = new TextWidget(line, pointSize: helpPointSize, textColor: RGBA_Bytes.White); helpWidget.Margin = new BorderDouble(5, 0, 0, 0); helpWidget.HAnchor = HAnchor.ParentLeft; allText.AddChild(helpWidget); } allText.MinimumSize = new Vector2(textRegionWidth, allText.MinimumSize.y); if (wrappedText.Length > 0) { topToBottomSettings.AddChild(allText); } }