Fix window render

This commit is contained in:
Miguel de Icaza
2017-12-15 19:46:17 -05:00
parent 693c5e3452
commit 978cc9922b
2 changed files with 7 additions and 7 deletions

View File

@@ -141,12 +141,12 @@ namespace Terminal {
internal void ViewToScreen (int col, int row, out int rcol, out int rrow, bool clipped = true) internal void ViewToScreen (int col, int row, out int rcol, out int rrow, bool clipped = true)
{ {
// Computes the real row, col relative to the screen. // Computes the real row, col relative to the screen.
rrow = row; rrow = row + frame.X;
rcol = col; rcol = col + frame.Y;
var ccontainer = container; var ccontainer = container;
while (ccontainer != null){ while (ccontainer != null){
rrow += container.frame.Y; rrow += ccontainer.frame.Y;
rcol += container.frame.X; rcol += ccontainer.frame.X;
ccontainer = ccontainer.container; ccontainer = ccontainer.container;
} }
@@ -419,7 +419,7 @@ namespace Terminal {
void DrawFrame () void DrawFrame ()
{ {
DrawFrame (Frame, true); DrawFrame (new Rect (Point.Empty, Frame.Size), true);
} }
public override void Redraw () public override void Redraw ()
@@ -431,7 +431,7 @@ namespace Terminal {
Driver.SetColor (Colors.Dialog.Normal); Driver.SetColor (Colors.Dialog.Normal);
var width = Frame.Width; var width = Frame.Width;
if (Title != null && width > 4) { if (Title != null && width > 4) {
Move (0, 1); Move (1, 0);
Driver.AddCh (' '); Driver.AddCh (' ');
var str = Title.Length > width ? Title.Substring (0, width - 4) : Title; var str = Title.Length > width ? Title.Substring (0, width - 4) : Title;
Driver.AddStr (str); Driver.AddStr (str);

View File

@@ -5,7 +5,7 @@ class Demo {
{ {
Application.Init (); Application.Init ();
var top = Application.Top; var top = Application.Top;
top.Add (new Window (new Rect (10, 10, 20, 20), "Hello")); top.Add (new Window (new Rect (10, 10, 20, 10), "Hello"));
Application.Run (); Application.Run ();
} }
} }