mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-02 01:03:29 +01:00
Added a HorizontalSpace property.
This commit is contained in:
@@ -11,6 +11,7 @@ namespace Terminal.Gui {
|
|||||||
int selected = -1;
|
int selected = -1;
|
||||||
int cursor;
|
int cursor;
|
||||||
DisplayModeLayout displayMode;
|
DisplayModeLayout displayMode;
|
||||||
|
int horizontalSpace = 2;
|
||||||
List<(int pos, int length)> horizontal;
|
List<(int pos, int length)> horizontal;
|
||||||
|
|
||||||
void Init (Rect rect, ustring [] radioLabels, int selected)
|
void Init (Rect rect, ustring [] radioLabels, int selected)
|
||||||
@@ -78,6 +79,20 @@ namespace Terminal.Gui {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the horizontal space for this <see cref="RadioGroup"/> if the <see cref="DisplayMode"/> is <see cref="DisplayModeLayout.Horizontal"/>
|
||||||
|
/// </summary>
|
||||||
|
public int HorizontalSpace {
|
||||||
|
get { return horizontalSpace; }
|
||||||
|
set {
|
||||||
|
if (horizontalSpace != value && displayMode == DisplayModeLayout.Horizontal) {
|
||||||
|
horizontalSpace = value;
|
||||||
|
SetWidthHeight (radioLabels);
|
||||||
|
SetNeedsDisplay ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SetWidthHeight (List<ustring> radioLabels)
|
void SetWidthHeight (List<ustring> radioLabels)
|
||||||
{
|
{
|
||||||
switch (displayMode) {
|
switch (displayMode) {
|
||||||
@@ -147,7 +162,7 @@ namespace Terminal.Gui {
|
|||||||
int length = 0;
|
int length = 0;
|
||||||
for (int i = 0; i < radioLabels.Count; i++) {
|
for (int i = 0; i < radioLabels.Count; i++) {
|
||||||
start += length;
|
start += length;
|
||||||
length = radioLabels [i].RuneCount + 2;
|
length = radioLabels [i].RuneCount + horizontalSpace;
|
||||||
horizontal.Add ((start, length));
|
horizontal.Add ((start, length));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user