Ejemplo n.º 1
0
        public override void Draw()
        {
            if (ContainingApp == null)
            {
                return;
            }

            RemoveCursor();

            string clippedPath;

            if (Selected)
            {
                clippedPath = ' ' + Text.PadRight(Width + _offset, ' ').Substring(_offset, Width - 2);
            }
            else
            {
                clippedPath = ' ' + Text.PadRight(Width, ' ').Substring(0, Width - 2);
            }

            ContainingApp.WirteText(clippedPath + " ", Origin.X, Origin.Y, TEXT_COLOR, BACKGROUND_COLOR);
            if (Selected)
            {
                ShowCursor();
            }
        }
Ejemplo n.º 2
0
 public void Draw()
 {
     if (ContainingApp == null)
     {
         return;
     }
     ContainingApp.WirteText(_letterUnderCursor.ToString(), Origin.X, Origin.Y, _foregroundColor, _backgroundColor);
 }
Ejemplo n.º 3
0
 public override void Draw()
 {
     if (ContainingApp == null)
     {
         return;
     }
     ContainingApp.WirteText(Text, Origin.X, Origin.Y, TextColour, BackgroundColour);
 }
Ejemplo n.º 4
0
 public override void Draw()
 {
     if (ContainingApp == null)
     {
         return;
     }
     base.Draw();
     ContainingApp.DrawColorBlock(TitleBarColour, X, Y, X + 1, Y + Width); //Title Bar
     ContainingApp.WirteText(' ' + Title + ' ', X, Y + 2, TitleColour, BackgroundColor);
 }
Ejemplo n.º 5
0
 public override void Draw()
 {
     if (ContainingApp == null)
     {
         return;
     }
     if (Selected)
     {
         ContainingApp.WirteText("<" + Text + ">", Origin.X, Origin.Y, SELECTED_TEXT_COLOR, SELECTED_BACKGROUND_COLOR);
     }
     else
     {
         ContainingApp.WirteText("<" + Text + ">", Origin.X, Origin.Y, TEXT_COLOR, BACKGROUND_COLOR);
     }
 }
Ejemplo n.º 6
0
 public override void Draw()
 {
     if (ContainingApp == null)
     {
         return;
     }
     if (Selected)
     {
         ContainingApp.WirteText('[' + Text + ']', Origin.X, Origin.Y, SelectedTextColour, SelectedBackgroundColour);
     }
     else
     {
         ContainingApp.WirteText('[' + Text + ']', Origin.X, Origin.Y, TextColour, BackgroudColour);
     }
 }
Ejemplo n.º 7
0
        public override void Draw()
        {
            if (ContainingApp == null)
            {
                return;
            }
            var paddedText = ('[' + Text + ']').PadRight(Width, ' ');

            if (Selected)
            {
                ContainingApp.WirteText(paddedText, Origin.X, Origin.Y, SelectedTextColour, SelectedBackgroundColour);
            }
            else
            {
                ContainingApp.WirteText(paddedText, Origin.X, Origin.Y, TextColour, BackgroudColour);
            }
        }
Ejemplo n.º 8
0
        public override void Draw()
        {
            if (ContainingApp == null)
            {
                return;
            }
            var Char = Checked ? "X" : " ";

            if (Selected)
            {
                ContainingApp.WirteText('[' + Char + ']', X, Y, SelectedTextColour, SelectedBackgroundColour);
            }
            else
            {
                ContainingApp.WirteText('[' + Char + ']', X, Y, TextColour, BackgroundColour);
            }
        }
Ejemplo n.º 9
0
        public override void Draw()
        {
            if (ContainingApp == null)
            {
                return;
            }
            var paddedText = Text.PadRight(Length - 2, ' ').Substring(0, Length - 2);

            if (Selected)
            {
                ContainingApp.WirteText('[' + paddedText + '▼' + ']', X, Y, SelectedTextColour, SelectedBackgroundColour);
            }
            else
            {
                ContainingApp.WirteText('[' + paddedText + '▼' + ']', X, Y, TextColour, BackgroudColour);
            }
        }
Ejemplo n.º 10
0
        public override void Draw()
        {
            if (ContainingApp == null)
            {
                return;
            }

            RemoveCursor();

            UpdateCursorDisplayPostion();

            var lines = _splitText;

            //Draw test area
            for (var i = _offset; i < Height + _offset; i++)
            {
                var line = ' ' + "".PadRight(Width - 1, ' ');
                if (lines.Count > i)
                {
                    line = ' ' + RemoveNewLine(lines[i]).PadRight(Width - 1, ' ');
                }

                ContainingApp.WirteText(line, i + Origin.X - _offset, Origin.Y, TEXT_COLOR, BackgroundColour);
            }

            if (_selected)
            {
                ShowCursor();
            }

            //Draw Scroll Bar
            ContainingApp.DrawColorBlock(ConsoleColor.White, Origin.X + Width, Origin.Y, Origin.X + Width + 1, Origin.Y + Height);

            double linesPerPixel = (double)lines.Count() / (Height);
            var    postion       = 0;

            if (linesPerPixel > 0)
            {
                postion = (int)Math.Floor(_cursorDisplayX / linesPerPixel);
            }

            ContainingApp.WirteText("■", Origin.X + postion, Origin.Y + Width, ConsoleColor.DarkGray, ConsoleColor.White);
        }
Ejemplo n.º 11
0
        public Control GetNextControlRight(bool selectableControlsOnly = false)
        {
            if (CurrentlySelected == null)
            {
                return(null);
            }

            // Get all controls that collide with a rightward ray-trace the height of this control
            var rayPos = new Point {
                X = CurrentlySelected.Origin.X + CurrentlySelected.Width,
                Y = CurrentlySelected.Origin.Y
            };
            var rayWidth  = Width - (CurrentlySelected.Origin.X + CurrentlySelected.Width);
            var rayHeight = CurrentlySelected.Height;

            ContainingApp.DrawColorBlock(ConsoleColor.Magenta, rayPos.X, rayPos.Y, rayPos.X + rayWidth, rayPos.Y + rayHeight);

            var controlsInRay = from control in _controls
                                where DoAreasOverlap(
                rayPos.X, rayPos.Y, rayWidth, rayHeight,
                control.Origin.X, control.Origin.Y, control.Width, control.Height)
                                select control;

            if (controlsInRay.Any())
            {
                var s = 2;
            }


            // Return the closest one to the right edge of this control, If one exists

            // Else, return the next control in Controls list


            return(null);
        }
Ejemplo n.º 12
0
        override public void Draw()
        {
            if (ContainingApp == null)
            {
                return;
            }
            ParentWindow.ContainingApp.DrawColorBlock(BackgroundColour, X, Y, X + Height, Y + Width);

            if (!ShowingDrive)
            {
                var trimedPath = CurrentPath.PadRight(Width - 2, ' ');
                trimedPath = trimedPath.Substring(trimedPath.Count() - Width + 2, Width - 2);
                ContainingApp.WirteText(trimedPath, X, Y + 1, ConsoleColor.Gray, BackgroundColour);
            }
            else
            {
                ContainingApp.WirteText("Drives", X, Y + 1, ConsoleColor.Gray, BackgroundColour);
            }

            if (!ShowingDrive)
            {
                var i = Offset;
                while (i < Math.Min(Folders.Count, Height + Offset - 1))
                {
                    var folderName = Folders[i].PadRight(Width - 2, ' ').Substring(0, Width - 2);

                    if (i == CursorX)
                    {
                        if (Selected)
                        {
                            ContainingApp.WirteText(folderName, X + i - Offset + 1, Y + 1, SelectedTextColour, SelectedBackgroundColour);
                        }
                        else
                        {
                            ContainingApp.WirteText(folderName, X + i - Offset + 1, Y + 1, SelectedTextColour, BackgroundColour);
                        }
                    }
                    else
                    {
                        ContainingApp.WirteText(folderName, X + i - Offset + 1, Y + 1, TextColour, BackgroundColour);
                    }

                    i++;
                }

                while (i < Math.Min(Folders.Count + FileNames.Count, Height + Offset - 1))
                {
                    var fileName = FileNames[i - Folders.Count].PadRight(Width - 2, ' ').Substring(0, Width - 2);

                    if (i == CursorX)
                    {
                        if (Selected)
                        {
                            ContainingApp.WirteText(fileName, X + i - Offset + 1, Y + 1, SelectedTextColour, SelectedBackgroundColour);
                        }
                        else
                        {
                            ContainingApp.WirteText(fileName, X + i - Offset + 1, Y + 1, SelectedTextColour, BackgroundColour);
                        }
                    }
                    else
                    {
                        ContainingApp.WirteText(fileName, X + i - Offset + 1, Y + 1, TextColour, BackgroundColour);
                    }
                    i++;
                }
            }
            else
            {
                for (var i = 0; i < Drives.Count(); i++)
                {
                    if (i == CursorX)
                    {
                        if (Selected)
                        {
                            ContainingApp.WirteText(Drives[i], X + i - Offset + 1, Y + 1, SelectedTextColour, SelectedBackgroundColour);
                        }
                        else
                        {
                            ContainingApp.WirteText(Drives[i], X + i - Offset + 1, Y + 1, SelectedTextColour, BackgroundColour);
                        }
                    }
                    else
                    {
                        ContainingApp.WirteText(Drives[i], X + i - Offset + 1, Y + 1, TextColour, BackgroundColour);
                    }
                }
            }
        }
Ejemplo n.º 13
0
 private void DrawBackground()
 {
     ContainingApp.DrawColorBlock(BackgroundColor, Origin.X, Origin.Y, Origin.X + Width, Origin.Y + Height); // Main background box
 }