Bläddra i källkod

Remove View AutoSize and add TextFormatter.AutoSize.

BDisp 1 år sedan
förälder
incheckning
9f1f2c7dac
1 ändrade filer med 33 tillägg och 4 borttagningar
  1. 33 4
      UICatalog/Scenarios/TextAlignmentsAndDirection.cs

+ 33 - 4
UICatalog/Scenarios/TextAlignmentsAndDirection.cs

@@ -474,13 +474,11 @@ public class TextAlignmentsAndDirections : Scenario
         {
         {
             X = Pos.Right (container) + 1,
             X = Pos.Right (container) + 1,
             Y = Pos.Y (justifyCheckbox) + 1,
             Y = Pos.Y (justifyCheckbox) + 1,
-            AutoSize = false,
             Width = Dim.Fill (10),
             Width = Dim.Fill (10),
             Height = 1,
             Height = 1,
             Text = "Word Wrap",
             Text = "Word Wrap",
-            Checked = true
         };
         };
-
+        wrapCheckbox.Checked = wrapCheckbox.TextFormatter.WordWrap;
         wrapCheckbox.Toggled += (s, e) =>
         wrapCheckbox.Toggled += (s, e) =>
                                 {
                                 {
                                     if (e.OldValue == true)
                                     if (e.OldValue == true)
@@ -501,6 +499,37 @@ public class TextAlignmentsAndDirections : Scenario
 
 
         app.Add (wrapCheckbox);
         app.Add (wrapCheckbox);
 
 
+        // AUTOSIZE CHECKBOX
+
+        var autoSizeCheckbox = new CheckBox
+        {
+            X = Pos.Right (container) + 1,
+            Y = Pos.Y (wrapCheckbox) + 1,
+            Width = Dim.Fill (10),
+            Height = 1,
+            Text = "AutoSize",
+        };
+        autoSizeCheckbox.Checked = autoSizeCheckbox.TextFormatter.AutoSize;
+        autoSizeCheckbox.Toggled += (s, e) =>
+                                    {
+                                        if (e.OldValue == true)
+                                        {
+                                            foreach (Label t in mtxts)
+                                            {
+                                                t.TextFormatter.AutoSize = false;
+                                            }
+                                        }
+                                        else
+                                        {
+                                            foreach (Label t in mtxts)
+                                            {
+                                                t.TextFormatter.AutoSize = true;
+                                            }
+                                        }
+                                    };
+
+        app.Add (autoSizeCheckbox);
+
         // Direction Options
         // Direction Options
 
 
         List<TextDirection> directionsEnum = Enum.GetValues (typeof (TextDirection)).Cast<TextDirection> ().ToList ();
         List<TextDirection> directionsEnum = Enum.GetValues (typeof (TextDirection)).Cast<TextDirection> ().ToList ();
@@ -508,7 +537,7 @@ public class TextAlignmentsAndDirections : Scenario
         var directionOptions = new RadioGroup
         var directionOptions = new RadioGroup
         {
         {
             X = Pos.Right (container) + 1,
             X = Pos.Right (container) + 1,
-            Y = Pos.Bottom (wrapCheckbox) + 1,
+            Y = Pos.Bottom (autoSizeCheckbox) + 1,
             Width = Dim.Fill (10),
             Width = Dim.Fill (10),
             Height = Dim.Fill (1),
             Height = Dim.Fill (1),
             HotKeySpecifier = (Rune)'\xffff',
             HotKeySpecifier = (Rune)'\xffff',