Beispiel #1
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 #2
0
 public static StatusItem NewStatusKey(string text, KeyboardKeys keyCode, int command, StatusItem next)
 {
     return(new StatusItem()
     {
         Text = text,
         KeyCode = keyCode,
         Command = command,
         Next = next
     });
 }