예제 #1
0
 public PullDownMenus(Heads parent, string Caption, CallBackVoid CB, Keys QuickKey = Keys.None, RequireBool Requirement = null)
 {
     ParentTop = parent;
     Parent    = Top[parent];
     Parent.Kids.Add(this);
     this.Caption  = Caption;
     CaptGraph     = Void.Font.Text(Caption);
     CallBack      = CB;
     this.QuickKey = QuickKey;
     if (Requirement != null)
     {
         Require = Requirement;
     }
     else
     {
         Require = Always;
     }
     Debug.WriteLine($"Created menu item {Caption} in parent {parent}");
 }
예제 #2
0
        static public void Draw()
        {
            TQMG.Color(Color.White);
            Void.Back.Draw(0, 0, 0, 0, TQMG.ScrWidth, 20);
            var nix = 5;

            foreach (Heads h in (Heads[])Enum.GetValues(typeof(Heads)))
            {
                if (Top[h] == null)
                {
                    new PullDownMenus(h);
                    Top[h].TopX      = nix;
                    Top[h].Caption   = $"{h}";
                    Top[h].CaptGraph = Void.Font.Text(Top[h].Caption, true);
                }
                if (Selected == Top[h])
                {
                    TQMG.Color(0, 255, 255);
                    TQMG.DrawRectangle(nix - 5, 0, Top[h].CaptGraph.Width + 10, 20);
                    TQMG.Color(Color.Black);
                }
                else
                {
                    TQMG.Color(0, 255, 255);
                }
                Top[h].CaptGraph.Draw(nix, 4);
                if (Void.ms.LeftButton == ButtonState.Pressed)
                {
                    if (Void.ms.X > nix && Void.ms.Y < 20 && Void.ms.X < nix + Top[h].CaptGraph.Width + 10)
                    {
                        Selected = Top[h];
                    }
                }
                nix += Top[h].CaptGraph.Width + 10;
            }
        }