Beispiel #1
0
        public override void Draw()
        {
            uint       Color;
            DrawBuffer B = new DrawBuffer(Size.X * Size.Y);
            byte       SCOff;

            if (Light)
            {
                Color = GetColor(0x0402);
                SCOff = 0;
            }
            else
            {
                Color = GetColor(0x0301);
                SCOff = 4;
            }
            B.FillChar(' ', Color, (int)Size.X);
            if (Text != "")
            {
                B.FillCStr(Text, Color, 0);
            }
            if (ShowMarkers)
            {
                B.drawBuffer[0].AsciiChar = (char)SpecialChars[SCOff];
            }
            WriteLine(0, 0, (int)Size.X, 1, B);
        }
Beispiel #2
0
        public override void Draw()
        {
            DrawBuffer B = new DrawBuffer(Size.X * Size.Y);

            B.FillCStr(ldHistoryDropDown, GetColor(0x0102), 0);
            WriteLine(0, 0, (int)Size.X, (int)Size.Y, B);
        }
Beispiel #3
0
        public override void Draw()
        {
            int        X, L;
            uint       CNormal, CSelect, CNormDisabled, CSelDisabled, Color;
            MenuItem   P;
            DrawBuffer B = new DrawBuffer(Size.X * Size.Y);

            CNormal       = GetColor(0x0301);
            CSelect       = GetColor(0x0604);
            CNormDisabled = GetColor(0x0202);
            CSelDisabled  = GetColor(0x0505);
            B.FillChar(' ', CNormal, (byte)Size.X);
            if (Menu != null)
            {
                X = 1;
                P = Menu.Items;
                while (P != null)
                {
                    if (P.Name != "")
                    {
                        L = P.CNameLen();
                        if ((X + L) < Size.X)
                        {
                            if (P.Disabled)
                            {
                                if (P == Current)
                                {
                                    Color = CSelect;
                                }
                                else
                                {
                                    Color = CNormDisabled;
                                }
                            }
                            else
                            if (P == Current)
                            {
                                Color = CSelect;
                            }
                            else
                            {
                                Color = CNormal;
                            }
                            B.FillChar(' ', Color, 1, X);
                            B.FillCStr(P.Name, Color, X + 1);
                            B.FillChar(' ', Color, 1, X + L + 1);
                        }
                        X += L + 2;
                    }
                    P = P.Next;
                }
            }
            WriteBuf(0, 0, (byte)Size.X, 1, B);
        }
Beispiel #4
0
        public void DrawMultiBox(string Icon, string Marker)
        {
            int        Cur, Col;
            uint       CNorm, CSel, CDis, Color;
            DrawBuffer B = new DrawBuffer(Size.X * Size.Y);

            CNorm = GetColor(0x0301);
            CSel  = GetColor(0x0402);
            CDis  = GetColor(0x0505);

            for (int i = 0; i <= Size.Y; i++)
            {
                B.FillChar(' ', (byte)CNorm, Size.X);
                for (int j = 0; j <= ((Strings.Count / Size.Y) + 1); j++)
                {
                    Cur = (int)(j * Size.Y + i);
                    if (Cur < Strings.Count)
                    {
                        Col = Column(Cur);
                        if (((Col + ItemCLen(Strings[Cur]) + 5) <
                             (B.drawBuffer.Length)) && (Col < Size.X))
                        {
                            if (!ButtonState(Cur))
                            {
                                Color = CDis;
                            }
                            else
                            if ((Cur == Sel) && ((State & StateFlags.Focused) != 0))
                            {
                                Color = CSel;
                            }
                            else
                            {
                                Color = CNorm;
                            }
                            B.FillChar((char)' ', (byte)Color, (int)Size.X - Col, Col);
                            B.FillStr(Icon, (byte)Color, Col);
                            B.drawBuffer[Col + 2].AsciiChar = (char)Marker[MultiMark(Cur)];
                            B.FillCStr(Strings[Cur], (uint)Color, Col + 5);
                            if (ShowMarkers && ((State & StateFlags.Focused) != 0) && (Cur == Sel))
                            {
                                B.drawBuffer[Col].AsciiChar = (char)SpecialChars[0];
                                B.drawBuffer[Column((int)(Cur + Size.Y)) - 1].AsciiChar = (char)SpecialChars[1];
                            }
                        }
                    }
                }
                WriteBuf(0, i, (int)Size.X, 1, B);
            }
            SetCursor(Column(Sel) + 2, Row(Sel));
        }
Beispiel #5
0
        public override void Draw()
        {
            const int  Width = 20;
            int        DayOf, CurDays;
            string     S;
            DrawBuffer B = new DrawBuffer(Size.X * Size.Y);
            uint       Color, BoldColor;

            Color     = (byte)GetColor(6);
            BoldColor = (byte)GetColor(7);
            DayOf     = (int)(new DateTime((int)Year, (int)Month, 1)).DayOfWeek;
            Days      = (byte)(DaysInMonth[(int)(Month - 1)]);
            if (((Year % 4) == 0) && (Month == 2))
            {
                Days++;
            }
            S = string.Format("{0:0000}", Year);
            B.FillChar(' ', Color, Width);
            B.FillCStr(string.Format("{0,-10} {1} \x1E \x1F", MonthStr[Month - 1], S), Color, 0);
            WriteLine(0, 0, Width, 1, B);
            B.FillChar(' ', Color, Width);
            B.FillStr(DayString, Color, 0);
            WriteLine(0, 1, Width, 1, B);
            CurDays = 1 - DayOf;
            for (int i = 1; i <= 6; i++)
            {
                for (int j = 0; j <= 6; j++)
                {
                    if ((CurDays < 1) || (CurDays > Days))
                    {
                        B.FillStr("   ", Color, j * 3);
                    }
                    else
                    if ((Year == CurYear) && (Month == CurMonth) && (CurDays == CurDay))
                    {
                        B.FillStr(string.Format("{0:00}", CurDays), BoldColor, j * 3);
                    }
                    else
                    {
                        B.FillStr(string.Format("{0:00}", CurDays), Color, j * 3);
                    }
                    CurDays++;
                }
                WriteLine(0, i + 1, Width, 1, B);
            }
        }
Beispiel #6
0
        public override void Draw()
        {
            DrawBuffer B = new DrawBuffer(Size.X * Size.Y);
            byte       C;

            if (Clicked)
            {
                C = (byte)GetColor(2);
            }
            else
            {
                C = (byte)GetColor(1);
            }

            B.FillChar((char)' ', C, (int)Size.X);
            B.FillCStr(Text, C, 0);
            WriteLine(0, 0, (int)Size.X, 1, B);
        }
Beispiel #7
0
        internal void DrawTitle(DrawBuffer B, ref int I, ref int S, uint CButton, bool Down)
        {
            int L, SCOff;

            if ((Flags & ButtonFlags.LeftJust) != 0)
            {
                L = 1;
            }
            else
            {
                L = (S - CTitleLen() - 1) / 2;
                if (L < 1)
                {
                    L = 1;
                }
                B.FillCStr(Title, CButton, I + L);
                if (ShowMarkers & !Down)
                {
                    if ((State & StateFlags.Selected) != 0)
                    {
                        SCOff = 0;
                    }
                    else
                    if (AmDefault)
                    {
                        SCOff = 2;
                    }
                    else
                    {
                        SCOff = 4;
                    }
                    B.drawBuffer[0].AsciiChar = SpecialChars[SCOff];
                    B.drawBuffer[S].AsciiChar = SpecialChars[SCOff + 1];
                }
            }
        }
Beispiel #8
0
        public override void Draw()
        {
            uint       CNormal, CSelect, CNormDisabled, CSelDisabled, Color;
            int        Y;
            MenuItem   P;
            DrawBuffer B = new DrawBuffer(Size.X * Size.Y);

            CNormal       = GetColor(0x0301);
            CSelect       = GetColor(0x0604);
            CNormDisabled = GetColor(0x0202);
            CSelDisabled  = GetColor(0x0505);

            Y     = 0;
            Color = CNormal;
            FrameLine(0, B, CNormal, Color);
            DrawLine(ref Y, B);
            if (Menu != null)
            {
                P = Menu.Items;
                while (P != null)
                {
                    Color = CNormal;
                    if (P.Name == "")
                    {
                        FrameLine(15, B, (byte)CNormal, (byte)Color);
                    }
                    else
                    {
                        if (P.Disabled)
                        {
                            if (P == Current)
                            {
                                Color = CSelDisabled;
                            }
                            else
                            {
                                Color = CNormDisabled;
                            }
                        }
                        else
                        if (P == Current)
                        {
                            Color = CSelect;
                        }
                        FrameLine(10, B, CNormal, Color);
                        B.FillCStr(P.Name, Color, 3);
                        if (P.Command == 0)
                        {
                            B.FillChar(ldSubMenuArrow, Color, 1, (int)Size.X - 4);
                        }
                        else
                        if (P.Param != "")
                        {
                            B.FillStr(P.Param, Color, (int)Size.X - 3 - P.Param.Length);
                        }
                    }
                    DrawLine(ref Y, B);
                    P = P.Next;
                }
            }
            Color = CNormal;
            FrameLine(5, B, CNormal, Color);
            DrawLine(ref Y, B);
        }
Beispiel #9
0
        public void DrawSelect(StatusItem Selected)
        {
            DrawBuffer B = new DrawBuffer(Size.X * Size.Y);
            int        I, L;
            StatusItem T;
            uint       CSelect, CNormal, CSelDisabled, CNormDisabled;
            uint       Color;
            string     HintBuf;

            CNormal       = GetColor(0x0301);
            CSelect       = GetColor(0x0604);
            CNormDisabled = GetColor(0x0202);
            CSelDisabled  = GetColor(0x0505);

            B.FillChar(' ', CNormal, (int)Size.X);
            T = Items;
            I = 0;
            while (T != null)
            {
                if (T.Text != "")
                {
                    L = T.CTextLen();
                    if (((I + L) - 1) < Size.X)
                    {
                        if (CommandEnabled(T.Command))
                        {
                            if (T == Selected)
                            {
                                Color = CSelect;
                            }
                            else
                            {
                                Color = CNormal;
                            }
                        }
                        else
                        if (T == Selected)
                        {
                            Color = CSelDisabled;
                        }
                        else
                        {
                            Color = CNormDisabled;
                        }
                        B.FillCStr(T.Text, Color, I);
                        B.FillChar(' ', CNormal, 1, (int)I + L);
                    }
                    I += (L + 1);
                }
                T = T.Next;
            }
            if (I < (Size.X - 2))
            {
                HintBuf = Hint(HelpCtx);
                if (HintBuf != "")
                {
                    B.FillChar(ldVerticalBar, CNormal, 1, I);
                    I += 2;
                    if ((I + HintBuf.Length) > Size.X)
                    {
                        HintBuf = HintBuf.Substring(0, (int)Size.X);
                    }
                    B.FillStr(HintBuf, CNormal, I);
                }
            }
            WriteLine(0, 0, (int)Size.X, 1, B);
        }
Beispiel #10
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);
        }