From 8a241b1cf850a358a2bb35e9051d8c19269b9fdb Mon Sep 17 00:00:00 2001 From: BDisp Date: Mon, 3 Aug 2020 23:58:06 +0100 Subject: [PATCH] Added a HorizontalSpace property. --- Terminal.Gui/Views/RadioGroup.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Terminal.Gui/Views/RadioGroup.cs b/Terminal.Gui/Views/RadioGroup.cs index 1939eec86..65f2dddb8 100644 --- a/Terminal.Gui/Views/RadioGroup.cs +++ b/Terminal.Gui/Views/RadioGroup.cs @@ -11,6 +11,7 @@ namespace Terminal.Gui { int selected = -1; int cursor; DisplayModeLayout displayMode; + int horizontalSpace = 2; List<(int pos, int length)> horizontal; void Init (Rect rect, ustring [] radioLabels, int selected) @@ -78,6 +79,20 @@ namespace Terminal.Gui { } } + /// + /// Gets or sets the horizontal space for this if the is + /// + public int HorizontalSpace { + get { return horizontalSpace; } + set { + if (horizontalSpace != value && displayMode == DisplayModeLayout.Horizontal) { + horizontalSpace = value; + SetWidthHeight (radioLabels); + SetNeedsDisplay (); + } + } + } + void SetWidthHeight (List radioLabels) { switch (displayMode) { @@ -147,7 +162,7 @@ namespace Terminal.Gui { int length = 0; for (int i = 0; i < radioLabels.Count; i++) { start += length; - length = radioLabels [i].RuneCount + 2; + length = radioLabels [i].RuneCount + horizontalSpace; horizontal.Add ((start, length)); } }