Пример #1
0
        public override void Draw()
        {
            DrawBuffer B = new DrawBuffer(Size.X * Size.Y);

            B.FillBuf(Program.SaveConsoleBuffer, (uint)(Size.X * Size.Y), 0);
            WriteBuf(0, 0, Size.X, Size.Y, B);
        }
Пример #2
0
 internal void FrameLine(int N, DrawBuffer B, uint CNormal, uint Color)
 {
     B.FillBuf(ldMenuFrameChars.Substring(N, 2), CNormal, 2);
     B.FillChar((char)ldMenuFrameChars[N + 2], Color, (int)(Size.X - 4), 2);
     B.FillBuf(ldMenuFrameChars.Substring(N + 3, 2), CNormal, 2, (int)(Size.X - 2));
 }
Пример #3
0
        public override void Draw()
        {
            uint       Color;
            bool       Center;
            int        I, J, L, P, Y;
            DrawBuffer B = new DrawBuffer(Size.X * Size.Y);
            string     S;

            Color = GetColor(1);
            S     = Text;
            L     = S.Length - 1;

            P = 0;
            Y = 0;

            Center = false;

            while (Y < Size.Y)
            {
                B.FillChar(' ', Color, Size.X);
                if (P <= L)
                {
                    if (S[P] == 0x03)
                    {
                        Center = true;
                        P++;
                    }
                    I = P;
                    do
                    {
                        J = P;
                        while ((P <= L) && (S[P] == ' '))
                        {
                            P++;
                        }
                        while ((P <= L) && (S[P] != ' ') && (S[P] != 0x0D))
                        {
                            P++;
                        }
                    }while(!((P > L) || (P >= (I + Size.X)) || (S[P] == 0x0D)));
                    if (P > I + Size.X)
                    {
                        if (J > I)
                        {
                            P = J;
                        }
                        else
                        {
                            P = I + Size.X;
                        }
                    }
                    if (Center)
                    {
                        J = (Size.X - P + I) / 2;
                    }
                    else
                    {
                        J = 0;
                    }
                    B.FillBuf(S.Substring(I), Color, (byte)(P - I), J);
                    while ((P <= L) && (S[P] == ' '))
                    {
                        P++;
                    }
                    if ((P <= L) && (S[P] == 0x0D))
                    {
                        Center = false;
                        P++;
                        if ((P <= L) && (S[P] == 0x0A))
                        {
                            P++;
                        }
                    }
                }
                WriteLine(0, Y, Size.X, 1, B);
                Y++;
            }
        }
Пример #4
0
        public override void Draw()
        {
            uint       CFrame, CTitle;
            int        F, I, L, Width;
            DrawBuffer B = new DrawBuffer(Size.X * Size.Y);
            string     Title;
            Point      Min, Max;

            if ((State & StateFlags.Dragging) != 0)
            {
                CFrame = 0x0505;
                CTitle = 0x0005;
                F      = 0;
            }
            else
            if ((State & StateFlags.Active) == 0)
            {
                CFrame = 0x0101;
                CTitle = 0x0002;
                F      = 0;
            }
            else
            {
                CFrame = 0x0503;
                CTitle = 0x0004;
                F      = 9;
            }
            CFrame = GetColor(CFrame);
            CTitle = GetColor(CTitle);
            Width  = (int)Size.X;
            L      = Width - 10;
            if (((Owner as Window).Flags & (WindowFlags.wfClose | WindowFlags.wfZoom)) != 0)
            {
                L -= 6;
            }
            FrameLine(B, 0, F, (byte)CFrame);
            if (((Owner as Window).Number != wnNoNumber) && ((Owner as Window).Number) < 10)
            {
                L -= 4;
                if (((Owner as Window).Flags & WindowFlags.wfZoom) != 0)
                {
                    I = 7;
                }
                else
                {
                    I = 3;
                }
                B.drawBuffer[Width - I].AsciiChar = (char)((Owner as Window).Number + 0x30);
            }
            if (Owner != null)
            {
                Title = (Owner as Window).GetTitle(L);
            }
            else
            {
                Title = "";
            }
            if (Title != "")
            {
                L = Title.Length;
                if (L > (Width - 10))
                {
                    L = Width - 10;
                }
                if (L < 0)
                {
                    L = 0;
                }
                I = (Width - L) >> 1;
                B.FillChar(' ', CTitle, 1, I - 1);
                B.FillBuf(Title, CTitle, (uint)L, I);
                B.FillChar(' ', CTitle, 1, I + L);
            }
            if ((State & StateFlags.Active) != 0)
            {
                if (((Owner as Window).Flags & WindowFlags.wfClose) != 0)
                {
                    if ((FrameMode & FrameModes.fmCloseClicked) == 0)
                    {
                        B.FillCStr(ldCloseWindow, CFrame, 2);
                    }
                    else
                    {
                        B.FillCStr(ldCloseClicked, CFrame, 2);
                    }
                }
                if (((Owner as Window).Flags & WindowFlags.wfZoom) != 0)
                {
                    B.FillCStr(ldMaximize, CFrame, Width - 5);
                    Owner.SizeLimits(out Min, out Max);
                    if ((FrameMode & FrameModes.fmZoomClicked) != 0)
                    {
                        B.drawBuffer[Width - 4].AsciiChar = '☼';
                    }
                    else
                    if ((Owner.Size.X == Max.X) && (Owner.Size.Y == Max.Y))
                    {
                        B.drawBuffer[Width - 4].AsciiChar = '↕';
                    }
                }
            }
            WriteLine(0, 0, (int)Size.X, 1, B);
            for (I = 1; I <= Size.Y - 2; I++)
            {
                FrameLine(B, I, F + 3, (byte)CFrame);
                WriteLine(0, I, (int)Size.X, 1, B);
            }
            FrameLine(B, (int)Size.Y - 1, F + 6, (byte)CFrame);
            if ((State & StateFlags.Active) != 0)
            {
                if (((Owner as Window).Flags & WindowFlags.wfGrow) != 0)
                {
                    B.FillCStr(ldBottomRight, CFrame, Width - 2);
                }
            }
            WriteLine(0, (int)Size.Y - 1, (int)Size.X, 1, B);
        }