Ejemplo n.º 1
0
        public void AddWidget(IWidget iw, int x, int y)
        {
            WidgetContainer wc = new WidgetContainer();

            wc.iw = iw;
            wc.x  = x + 1;
            wc.y  = y + 3;
            liw.Add(wc);
            focus.AddBefore(focus.Last, wc);
        }
Ejemplo n.º 2
0
        public void AddWidget(IWidget iw, int x, int y)
        {
            WidgetContainer wc = new WidgetContainer();

            wc.iw = iw;
            wc.x  = x;
            wc.y  = y;
            liw.Add(wc);
            focus.AddLast(wc);
            iw.UnFocused();
            if (currentFocus == null)
            {
                currentFocus = focus.First;
            }
            currentFocus.Value.iw.Focused();
        }
Ejemplo n.º 3
0
        public Window(int W, int H, string Title)
        {
            width  = W;
            height = H;
            title  = Title;
            cb     = new CloseButton();
            liw    = new List <WidgetContainer>();
            WidgetContainer wan = new WidgetContainer();

            wan.iw = cb;
            wan.x  = width;
            wan.y  = 1;
            liw.Add(wan);
            focus = new LinkedList <WidgetContainer> ();
            focus.AddFirst(wan);
            currentFocus = focus.First;
            currentFocus.Value.iw.Focused();
        }
Ejemplo n.º 4
0
 public void InputKey(ConsoleKeyInfo cki)
 {
     if (focus.First == null)
     {
         return;
     }
     if (cki.Modifiers == ConsoleModifiers.Control)
     {
         if (cki.Key == ConsoleKey.Tab)
         {
             if (currentFocus.Next == null)
             {
                 currentFocus.Value.iw.UnFocused();
                 currentFocus = focus.First;
                 currentFocus.Value.iw.Focused();
             }
             else
             {
                 currentFocus.Value.iw.UnFocused();
                 currentFocus = currentFocus.Next;
                 currentFocus.Value.iw.Focused();
             }
             return;
         }
         WidgetContainer wan = currentFocus.Value;
         if (cki.Key == ConsoleKey.UpArrow)
         {
             if (wan.y > 0)
             {
                 wan.y--;
             }
         }
         if (cki.Key == ConsoleKey.DownArrow)
         {
             if (wan.y < Console.WindowHeight - wan.iw.GetSize().Item2)
             {
                 wan.y++;
             }
         }
         if (cki.Key == ConsoleKey.LeftArrow)
         {
             if (wan.x > 0)
             {
                 wan.x--;
             }
         }
         if (cki.Key == ConsoleKey.RightArrow)
         {
             if (wan.x < Console.WindowWidth - wan.iw.GetSize().Item1)
             {
                 wan.x++;
             }
         }
         currentFocus.Value = wan;
     }
     if (currentFocus.Value.iw == this)
     {
         return;
     }
     currentFocus.Value.iw.InputKey(cki);
 }