|
@@ -35,7 +35,6 @@ public class TextAlignmentsAndDirections : Scenario
|
|
|
{
|
|
|
X = 1,
|
|
|
Y = 1,
|
|
|
- AutoSize = false,
|
|
|
Width = 9,
|
|
|
Height = 1,
|
|
|
TextAlignment = TextAlignment.Right,
|
|
@@ -47,7 +46,6 @@ public class TextAlignmentsAndDirections : Scenario
|
|
|
{
|
|
|
X = 1,
|
|
|
Y = 2,
|
|
|
- AutoSize = false,
|
|
|
Width = 9,
|
|
|
Height = 1,
|
|
|
TextAlignment = TextAlignment.Right,
|
|
@@ -59,7 +57,6 @@ public class TextAlignmentsAndDirections : Scenario
|
|
|
{
|
|
|
X = 1,
|
|
|
Y = 3,
|
|
|
- AutoSize = false,
|
|
|
Width = 9,
|
|
|
Height = 1,
|
|
|
TextAlignment = TextAlignment.Right,
|
|
@@ -71,7 +68,6 @@ public class TextAlignmentsAndDirections : Scenario
|
|
|
{
|
|
|
X = 1,
|
|
|
Y = 4,
|
|
|
- AutoSize = false,
|
|
|
Width = 9,
|
|
|
Height = 1,
|
|
|
TextAlignment = TextAlignment.Right,
|
|
@@ -83,7 +79,6 @@ public class TextAlignmentsAndDirections : Scenario
|
|
|
{
|
|
|
X = Pos.Right (labelHL) + 1,
|
|
|
Y = Pos.Y (labelHL),
|
|
|
- AutoSize = false,
|
|
|
Width = Dim.Fill (1) - 9,
|
|
|
Height = 1,
|
|
|
ColorScheme = color1,
|
|
@@ -95,7 +90,6 @@ public class TextAlignmentsAndDirections : Scenario
|
|
|
{
|
|
|
X = Pos.Right (labelHC) + 1,
|
|
|
Y = Pos.Y (labelHC),
|
|
|
- AutoSize = false,
|
|
|
Width = Dim.Fill (1) - 9,
|
|
|
Height = 1,
|
|
|
ColorScheme = color2,
|
|
@@ -107,7 +101,6 @@ public class TextAlignmentsAndDirections : Scenario
|
|
|
{
|
|
|
X = Pos.Right (labelHR) + 1,
|
|
|
Y = Pos.Y (labelHR),
|
|
|
- AutoSize = false,
|
|
|
Width = Dim.Fill (1) - 9,
|
|
|
Height = 1,
|
|
|
ColorScheme = color1,
|
|
@@ -119,7 +112,6 @@ public class TextAlignmentsAndDirections : Scenario
|
|
|
{
|
|
|
X = Pos.Right (labelHJ) + 1,
|
|
|
Y = Pos.Y (labelHJ),
|
|
|
- AutoSize = false,
|
|
|
Width = Dim.Fill (1) - 9,
|
|
|
Height = 1,
|
|
|
ColorScheme = color2,
|
|
@@ -147,7 +139,6 @@ public class TextAlignmentsAndDirections : Scenario
|
|
|
{
|
|
|
X = Pos.AnchorEnd (8),
|
|
|
Y = 1,
|
|
|
- AutoSize = false,
|
|
|
Width = 2,
|
|
|
Height = 9,
|
|
|
ColorScheme = color1,
|
|
@@ -155,12 +146,12 @@ public class TextAlignmentsAndDirections : Scenario
|
|
|
VerticalTextAlignment = VerticalTextAlignment.Bottom,
|
|
|
Text = "Top"
|
|
|
};
|
|
|
+ labelVT.TextFormatter.WordWrap = false;
|
|
|
|
|
|
var labelVM = new Label
|
|
|
{
|
|
|
X = Pos.AnchorEnd (6),
|
|
|
Y = 1,
|
|
|
- AutoSize = false,
|
|
|
Width = 2,
|
|
|
Height = 9,
|
|
|
ColorScheme = color1,
|
|
@@ -168,84 +159,84 @@ public class TextAlignmentsAndDirections : Scenario
|
|
|
VerticalTextAlignment = VerticalTextAlignment.Bottom,
|
|
|
Text = "Middle"
|
|
|
};
|
|
|
+ labelVM.TextFormatter.WordWrap = false;
|
|
|
|
|
|
var labelVB = new Label
|
|
|
{
|
|
|
X = Pos.AnchorEnd (4),
|
|
|
Y = 1,
|
|
|
- AutoSize = false,
|
|
|
- Width = 2,
|
|
|
Height = 9,
|
|
|
ColorScheme = color1,
|
|
|
TextDirection = TextDirection.TopBottom_LeftRight,
|
|
|
VerticalTextAlignment = VerticalTextAlignment.Bottom,
|
|
|
Text = "Bottom"
|
|
|
};
|
|
|
+ labelVB.TextFormatter.WordWrap = false;
|
|
|
|
|
|
var labelVJ = new Label
|
|
|
{
|
|
|
X = Pos.AnchorEnd (2),
|
|
|
Y = 1,
|
|
|
- AutoSize = false,
|
|
|
- Width = 1,
|
|
|
+ Width = 2,
|
|
|
Height = 9,
|
|
|
ColorScheme = color1,
|
|
|
TextDirection = TextDirection.TopBottom_LeftRight,
|
|
|
VerticalTextAlignment = VerticalTextAlignment.Bottom,
|
|
|
Text = "Justified"
|
|
|
};
|
|
|
+ labelVJ.TextFormatter.WordWrap = false;
|
|
|
|
|
|
var txtLabelVT = new Label
|
|
|
{
|
|
|
X = Pos.X (labelVT),
|
|
|
Y = Pos.Bottom (labelVT) + 1,
|
|
|
- AutoSize = false,
|
|
|
- Width = 1,
|
|
|
+ Width = 2,
|
|
|
Height = Dim.Fill (1),
|
|
|
ColorScheme = color1,
|
|
|
TextDirection = TextDirection.TopBottom_LeftRight,
|
|
|
VerticalTextAlignment = VerticalTextAlignment.Top,
|
|
|
Text = txt
|
|
|
};
|
|
|
+ txtLabelVT.TextFormatter.WordWrap = false;
|
|
|
|
|
|
var txtLabelVM = new Label
|
|
|
{
|
|
|
X = Pos.X (labelVM),
|
|
|
Y = Pos.Bottom (labelVM) + 1,
|
|
|
- AutoSize = false,
|
|
|
- Width = 1,
|
|
|
+ Width = 2,
|
|
|
Height = Dim.Fill (1),
|
|
|
ColorScheme = color2,
|
|
|
TextDirection = TextDirection.TopBottom_LeftRight,
|
|
|
VerticalTextAlignment = VerticalTextAlignment.Middle,
|
|
|
Text = txt
|
|
|
};
|
|
|
+ txtLabelVM.TextFormatter.WordWrap = false;
|
|
|
|
|
|
var txtLabelVB = new Label
|
|
|
{
|
|
|
X = Pos.X (labelVB),
|
|
|
Y = Pos.Bottom (labelVB) + 1,
|
|
|
- AutoSize = false,
|
|
|
- Width = 1,
|
|
|
+ Width = 2,
|
|
|
Height = Dim.Fill (1),
|
|
|
ColorScheme = color1,
|
|
|
TextDirection = TextDirection.TopBottom_LeftRight,
|
|
|
VerticalTextAlignment = VerticalTextAlignment.Bottom,
|
|
|
Text = txt
|
|
|
};
|
|
|
+ txtLabelVB.TextFormatter.WordWrap = false;
|
|
|
|
|
|
var txtLabelVJ = new Label
|
|
|
{
|
|
|
X = Pos.X (labelVJ),
|
|
|
Y = Pos.Bottom (labelVJ) + 1,
|
|
|
- AutoSize = false,
|
|
|
- Width = 1,
|
|
|
+ Width = 2,
|
|
|
Height = Dim.Fill (1),
|
|
|
ColorScheme = color2,
|
|
|
TextDirection = TextDirection.TopBottom_LeftRight,
|
|
|
VerticalTextAlignment = VerticalTextAlignment.Justified,
|
|
|
Text = txt
|
|
|
};
|
|
|
+ txtLabelVJ.TextFormatter.WordWrap = false;
|
|
|
|
|
|
txts.Add (txtLabelVT);
|
|
|
txts.Add (txtLabelVM);
|
|
@@ -268,7 +259,7 @@ public class TextAlignmentsAndDirections : Scenario
|
|
|
X = 0,
|
|
|
Y = Pos.Bottom (txtLabelHJ),
|
|
|
Width = Dim.Fill (31),
|
|
|
- Height = Dim.Fill (6),
|
|
|
+ Height = Dim.Fill (4),
|
|
|
ColorScheme = color2
|
|
|
};
|
|
|
|
|
@@ -276,7 +267,6 @@ public class TextAlignmentsAndDirections : Scenario
|
|
|
{
|
|
|
X = 1 /* */,
|
|
|
Y = 1,
|
|
|
- AutoSize = false,
|
|
|
Width = Dim.Percent (100f / 3f),
|
|
|
Height = Dim.Percent (100f / 3f),
|
|
|
TextAlignment = TextAlignment.Left,
|
|
@@ -284,12 +274,12 @@ public class TextAlignmentsAndDirections : Scenario
|
|
|
ColorScheme = color1,
|
|
|
Text = txt
|
|
|
};
|
|
|
+ txtLabelTL.TextFormatter.MultiLine = true;
|
|
|
|
|
|
var txtLabelTC = new Label
|
|
|
{
|
|
|
X = Pos.Right (txtLabelTL) + 2,
|
|
|
Y = 1,
|
|
|
- AutoSize = false,
|
|
|
Width = Dim.Percent (100f / 3f),
|
|
|
Height = Dim.Percent (100f / 3f),
|
|
|
TextAlignment = TextAlignment.Centered,
|
|
@@ -297,12 +287,12 @@ public class TextAlignmentsAndDirections : Scenario
|
|
|
ColorScheme = color1,
|
|
|
Text = txt
|
|
|
};
|
|
|
+ txtLabelTC.TextFormatter.MultiLine = true;
|
|
|
|
|
|
var txtLabelTR = new Label
|
|
|
{
|
|
|
X = Pos.Right (txtLabelTC) + 2,
|
|
|
Y = 1,
|
|
|
- AutoSize = false,
|
|
|
Width = Dim.Percent (100f, true),
|
|
|
Height = Dim.Percent (100f / 3f),
|
|
|
TextAlignment = TextAlignment.Right,
|
|
@@ -310,12 +300,12 @@ public class TextAlignmentsAndDirections : Scenario
|
|
|
ColorScheme = color1,
|
|
|
Text = txt
|
|
|
};
|
|
|
+ txtLabelTR.TextFormatter.MultiLine = true;
|
|
|
|
|
|
var txtLabelML = new Label
|
|
|
{
|
|
|
X = Pos.X (txtLabelTL),
|
|
|
Y = Pos.Bottom (txtLabelTL) + 1,
|
|
|
- AutoSize = false,
|
|
|
Width = Dim.Width (txtLabelTL),
|
|
|
Height = Dim.Percent (100f / 3f),
|
|
|
TextAlignment = TextAlignment.Left,
|
|
@@ -323,12 +313,12 @@ public class TextAlignmentsAndDirections : Scenario
|
|
|
ColorScheme = color1,
|
|
|
Text = txt
|
|
|
};
|
|
|
+ txtLabelML.TextFormatter.MultiLine = true;
|
|
|
|
|
|
var txtLabelMC = new Label
|
|
|
{
|
|
|
X = Pos.X (txtLabelTC),
|
|
|
Y = Pos.Bottom (txtLabelTC) + 1,
|
|
|
- AutoSize = false,
|
|
|
Width = Dim.Width (txtLabelTC),
|
|
|
Height = Dim.Percent (100f / 3f),
|
|
|
TextAlignment = TextAlignment.Centered,
|
|
@@ -336,12 +326,12 @@ public class TextAlignmentsAndDirections : Scenario
|
|
|
ColorScheme = color1,
|
|
|
Text = txt
|
|
|
};
|
|
|
+ txtLabelMC.TextFormatter.MultiLine = true;
|
|
|
|
|
|
var txtLabelMR = new Label
|
|
|
{
|
|
|
X = Pos.X (txtLabelTR),
|
|
|
Y = Pos.Bottom (txtLabelTR) + 1,
|
|
|
- AutoSize = false,
|
|
|
Width = Dim.Percent (100f, true),
|
|
|
Height = Dim.Percent (100f / 3f),
|
|
|
TextAlignment = TextAlignment.Right,
|
|
@@ -349,12 +339,12 @@ public class TextAlignmentsAndDirections : Scenario
|
|
|
ColorScheme = color1,
|
|
|
Text = txt
|
|
|
};
|
|
|
+ txtLabelMR.TextFormatter.MultiLine = true;
|
|
|
|
|
|
var txtLabelBL = new Label
|
|
|
{
|
|
|
X = Pos.X (txtLabelML),
|
|
|
Y = Pos.Bottom (txtLabelML) + 1,
|
|
|
- AutoSize = false,
|
|
|
Width = Dim.Width (txtLabelML),
|
|
|
Height = Dim.Percent (100f, true),
|
|
|
TextAlignment = TextAlignment.Left,
|
|
@@ -362,12 +352,12 @@ public class TextAlignmentsAndDirections : Scenario
|
|
|
ColorScheme = color1,
|
|
|
Text = txt
|
|
|
};
|
|
|
+ txtLabelBL.TextFormatter.MultiLine = true;
|
|
|
|
|
|
var txtLabelBC = new Label
|
|
|
{
|
|
|
X = Pos.X (txtLabelMC),
|
|
|
Y = Pos.Bottom (txtLabelMC) + 1,
|
|
|
- AutoSize = false,
|
|
|
Width = Dim.Width (txtLabelMC),
|
|
|
Height = Dim.Percent (100f, true),
|
|
|
TextAlignment = TextAlignment.Centered,
|
|
@@ -375,12 +365,12 @@ public class TextAlignmentsAndDirections : Scenario
|
|
|
ColorScheme = color1,
|
|
|
Text = txt
|
|
|
};
|
|
|
+ txtLabelBC.TextFormatter.MultiLine = true;
|
|
|
|
|
|
var txtLabelBR = new Label
|
|
|
{
|
|
|
X = Pos.X (txtLabelMR),
|
|
|
Y = Pos.Bottom (txtLabelMR) + 1,
|
|
|
- AutoSize = false,
|
|
|
Width = Dim.Percent (100f, true),
|
|
|
Height = Dim.Percent (100f, true),
|
|
|
TextAlignment = TextAlignment.Right,
|
|
@@ -388,6 +378,7 @@ public class TextAlignmentsAndDirections : Scenario
|
|
|
ColorScheme = color1,
|
|
|
Text = txt
|
|
|
};
|
|
|
+ txtLabelBR.TextFormatter.MultiLine = true;
|
|
|
|
|
|
mtxts.Add (txtLabelTL);
|
|
|
mtxts.Add (txtLabelTC);
|
|
@@ -467,42 +458,48 @@ public class TextAlignmentsAndDirections : Scenario
|
|
|
{
|
|
|
X = Pos.Right (container) + 1,
|
|
|
Y = Pos.Y (container) + 1,
|
|
|
- AutoSize = false,
|
|
|
Width = Dim.Fill (10),
|
|
|
Height = 1,
|
|
|
Text = "Justify"
|
|
|
};
|
|
|
|
|
|
- justifyCheckbox.Toggled += (s, e) =>
|
|
|
- {
|
|
|
- if (e.OldValue == true)
|
|
|
- {
|
|
|
- foreach (Label t in mtxts)
|
|
|
- {
|
|
|
- t.TextAlignment = (TextAlignment)((dynamic)t.Data).h;
|
|
|
- t.VerticalTextAlignment = (VerticalTextAlignment)((dynamic)t.Data).v;
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- foreach (Label t in mtxts)
|
|
|
- {
|
|
|
- if (TextFormatter.IsVerticalDirection (t.TextDirection))
|
|
|
- {
|
|
|
- t.VerticalTextAlignment = VerticalTextAlignment.Justified;
|
|
|
- t.TextAlignment = ((dynamic)t.Data).h;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- t.TextAlignment = TextAlignment.Justified;
|
|
|
- t.VerticalTextAlignment = ((dynamic)t.Data).v;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- };
|
|
|
+ justifyCheckbox.Toggled += (s, e) => ToggleJustify (e.OldValue is { } && (bool)e.OldValue);
|
|
|
|
|
|
app.Add (justifyCheckbox);
|
|
|
|
|
|
+ // WRAP CHECKBOX
|
|
|
+
|
|
|
+ var wrapCheckbox = new CheckBox
|
|
|
+ {
|
|
|
+ X = Pos.Right (container) + 1,
|
|
|
+ Y = Pos.Y (justifyCheckbox) + 1,
|
|
|
+ AutoSize = false,
|
|
|
+ Width = Dim.Fill (10),
|
|
|
+ Height = 1,
|
|
|
+ Text = "Word Wrap",
|
|
|
+ Checked = true
|
|
|
+ };
|
|
|
+
|
|
|
+ wrapCheckbox.Toggled += (s, e) =>
|
|
|
+ {
|
|
|
+ if (e.OldValue == true)
|
|
|
+ {
|
|
|
+ foreach (Label t in mtxts)
|
|
|
+ {
|
|
|
+ t.TextFormatter.WordWrap = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ foreach (Label t in mtxts)
|
|
|
+ {
|
|
|
+ t.TextFormatter.WordWrap = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ app.Add (wrapCheckbox);
|
|
|
+
|
|
|
// Direction Options
|
|
|
|
|
|
List<TextDirection> directionsEnum = Enum.GetValues (typeof (TextDirection)).Cast<TextDirection> ().ToList ();
|
|
@@ -510,7 +507,7 @@ public class TextAlignmentsAndDirections : Scenario
|
|
|
var directionOptions = new RadioGroup
|
|
|
{
|
|
|
X = Pos.Right (container) + 1,
|
|
|
- Y = Pos.Bottom (justifyCheckbox) + 1,
|
|
|
+ Y = Pos.Bottom (wrapCheckbox) + 1,
|
|
|
Width = Dim.Fill (10),
|
|
|
Height = Dim.Fill (1),
|
|
|
HotKeySpecifier = (Rune)'\xffff',
|
|
@@ -519,15 +516,52 @@ public class TextAlignmentsAndDirections : Scenario
|
|
|
|
|
|
directionOptions.SelectedItemChanged += (s, ev) =>
|
|
|
{
|
|
|
+ var justChecked = justifyCheckbox.Checked is { } && (bool)justifyCheckbox.Checked;
|
|
|
+ if (justChecked)
|
|
|
+ {
|
|
|
+ ToggleJustify (true);
|
|
|
+ }
|
|
|
foreach (Label v in mtxts)
|
|
|
{
|
|
|
v.TextDirection = (TextDirection)ev.SelectedItem;
|
|
|
}
|
|
|
+ if (justChecked)
|
|
|
+ {
|
|
|
+ ToggleJustify (false);
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
app.Add (directionOptions);
|
|
|
|
|
|
Application.Run (app);
|
|
|
app.Dispose ();
|
|
|
+
|
|
|
+ void ToggleJustify (bool oldValue)
|
|
|
+ {
|
|
|
+ if (oldValue == true)
|
|
|
+ {
|
|
|
+ foreach (Label t in mtxts)
|
|
|
+ {
|
|
|
+ t.TextAlignment = (TextAlignment)((dynamic)t.Data).h;
|
|
|
+ t.VerticalTextAlignment = (VerticalTextAlignment)((dynamic)t.Data).v;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ foreach (Label t in mtxts)
|
|
|
+ {
|
|
|
+ if (TextFormatter.IsVerticalDirection (t.TextDirection))
|
|
|
+ {
|
|
|
+ t.VerticalTextAlignment = VerticalTextAlignment.Justified;
|
|
|
+ t.TextAlignment = ((dynamic)t.Data).h;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ t.TextAlignment = TextAlignment.Justified;
|
|
|
+ t.VerticalTextAlignment = ((dynamic)t.Data).v;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|