浏览代码

Also fixed the position and unicode on StatusBar.

BDisp 5 年之前
父节点
当前提交
f34e869ad6
共有 3 个文件被更改,包括 13 次插入5 次删除
  1. 1 0
      Terminal.Gui/Core/Toplevel.cs
  2. 5 5
      Terminal.Gui/Views/StatusBar.cs
  3. 7 0
      UICatalog/Scenarios/Unicode.cs

+ 1 - 0
Terminal.Gui/Core/Toplevel.cs

@@ -286,6 +286,7 @@ namespace Terminal.Gui {
 
 		internal void PositionToplevels ()
 		{
+			PositionToplevel (this);
 			foreach (var top in Subviews) {
 				if (top is Toplevel) {
 					PositionToplevel ((Toplevel)top);

+ 5 - 5
Terminal.Gui/Views/StatusBar.cs

@@ -88,7 +88,7 @@ namespace Terminal.Gui {
 			CanFocus = false;
 			ColorScheme = Colors.Menu;
 			X = 0;
-			Y = Driver.Rows - 1;
+			Y = SuperView != null ? SuperView.Frame.Height - 1 : Pos.AnchorEnd (1);
 			Width = Dim.Fill ();
 			Height = 1;
 
@@ -100,8 +100,8 @@ namespace Terminal.Gui {
 			return delegate {
 				X = 0;
 				Height = 1;
-				if (SuperView == null || SuperView == Application.Top) {
-					Y = Driver.Rows - 1;
+				if (SuperView == null || SuperView is Toplevel) {
+					Y = SuperView.Frame.Height - 1;
 				} else {
 					//Y = Pos.Bottom (SuperView);
 				}
@@ -125,7 +125,7 @@ namespace Terminal.Gui {
 			//}
 
 			Move (0, 0);
-			Driver.SetAttribute (ColorScheme.Normal);
+			Driver.SetAttribute (Colors.Menu.Normal);
 			for (int i = 0; i < Frame.Width; i++)
 				Driver.AddRune (' ');
 
@@ -134,7 +134,7 @@ namespace Terminal.Gui {
 			Driver.SetAttribute (scheme);
 			for (int i = 0; i < Items.Length; i++) {
 				var title = Items [i].Title;
-				for (int n = 0; n < title.Length; n++) {
+				for (int n = 0; n < title.RuneCount; n++) {
 					if (title [n] == '~') {
 						scheme = ToggleScheme (scheme);
 						continue;

+ 7 - 0
UICatalog/Scenarios/Unicode.cs

@@ -36,6 +36,13 @@ namespace UICatalog {
 			});
 			Top.Add (menu);
 
+			var statusBar = new StatusBar (new StatusItem [] {
+				new StatusItem (Key.ControlQ, "~^Q~ Выход", () => Application.RequestStop()),
+				new StatusItem (Key.Unknown, "~F2~ Создать", null),
+				new StatusItem(Key.Unknown, "~F3~ Со_хранить", null),
+			});
+			Top.Add (statusBar);
+
 			var label = new Label ("Label:") { X = 0, Y = 1 };
 			Win.Add (label);
 			var testlabel = new Label (gitString) { X = 20, Y = Pos.Y (label), Width = Dim.Percent (50), };