protected override void KeyDown(object sender, KeyboardKeyEventArgs e)
        {
            LauncherTableWidget table = (LauncherTableWidget)widgets[tableIndex];

            if (e.Key == Key.Enter)
            {
                if (table.Count == 1 && String.IsNullOrEmpty(Get(hashIndex)))
                {
                    widgets[hashIndex].Text = table.usedEntries[0].Hash;
                    ConnectToServer(0, 0);
                }
                else
                {
                    base.KeyDown(sender, e);
                }
            }
            else if (e.Key == Key.Up)
            {
                table.SetSelected(table.SelectedIndex - 1);
                table.NeedRedraw();
            }
            else if (e.Key == Key.Down)
            {
                table.SetSelected(table.SelectedIndex + 1);
                table.NeedRedraw();
            }
            else
            {
                base.KeyDown(sender, e);
            }
        }
        void MakeTableWidget()
        {
            int tableHeight = Math.Max(game.Height - tableY - 50, 1);
            LauncherTableWidget widget;

            if (widgets[tableIndex] != null)
            {
                widget = (LauncherTableWidget)widgets[tableIndex];
            }
            else
            {
                widget = new LauncherTableWidget(game);
                widget.CurrentIndex = 0;
                widget.SetEntries(game.Session.Servers);

                widget.SetDrawData(drawer, tableFont, inputFont, inputFont,
                                   Anchor.LeftOrTop, Anchor.LeftOrTop, tableX, tableY);
                widget.NeedRedraw      = Resize;
                widget.SelectedChanged = SelectedChanged;
                widgets[widgetIndex]   = widget;
            }

            widget.Height = tableHeight;
            widgetIndex++;
        }
        void MouseButtonUp(object sender, MouseButtonEventArgs e)
        {
            LauncherTableWidget table = (LauncherTableWidget)widgets[tableIndex];

            table.DraggingColumn    = -1;
            table.DraggingScrollbar = false;
        }
        protected override void MouseWheelChanged(object sender, MouseWheelEventArgs e)
        {
            LauncherTableWidget table = (LauncherTableWidget)widgets[tableIndex];

            table.CurrentIndex -= e.Delta;
            table.ClampIndex();
            Resize();
        }
 protected override void MouseMove(object sender, MouseMoveEventArgs e)
 {
     base.MouseMove(sender, e);
     if (selectedWidget != null && selectedWidget == widgets[tableIndex])
     {
         LauncherTableWidget table = (LauncherTableWidget)widgets[tableIndex];
         table.MouseMove(e.X, e.Y, e.XDelta, e.YDelta);
     }
 }
        public override void Tick()
        {
            base.Tick();
            LauncherTableWidget table = (LauncherTableWidget)widgets[tableIndex];

            if (!game.Window.Mouse[MouseButton.Left])
            {
                table.DraggingColumn    = -1;
                table.DraggingScrollbar = false;
            }
        }
        protected override void RedrawLastInput()
        {
            base.RedrawLastInput();
            if (lastInput != widgets[hashIndex])
            {
                return;
            }
            LauncherTableWidget table = (LauncherTableWidget)widgets[tableIndex];

            table.SetSelected(widgets[hashIndex].Text);
            Resize();
        }
        void FilterList()
        {
            if (lastInput != widgets[searchIndex])
            {
                return;
            }
            LauncherTableWidget table = (LauncherTableWidget)widgets[tableIndex];

            table.FilterEntries(lastInput.Text);
            table.ClampIndex();
            Resize();
        }
        public override void Dispose()
        {
            base.Dispose();
            tableFont.Dispose();

            LauncherTableWidget table = widgets[tableIndex] as LauncherTableWidget;

            if (table != null)
            {
                table.DraggingColumn    = -1;
                table.DraggingScrollbar = false;
            }
        }
        public override void Resize()
        {
            DrawBackground();
            LauncherTableWidget table = (LauncherTableWidget)widgets[tableIndex];

            if (table != null)
            {
                table.ClampIndex();
            }
            MakeWidgets();
            RedrawAllButtonBackgrounds();

            using ( drawer ) {
                drawer.SetBitmap(game.Framebuffer);
                RedrawAll();
            }
            Dirty = true;
        }
        void MakeTableWidget()
        {
            int tableHeight = Math.Max( game.Height - tableY - 50, 1 );
            LauncherTableWidget widget;
            if( widgets[tableIndex] != null ) {
                widget = (LauncherTableWidget)widgets[tableIndex];
            } else {
                widget = new LauncherTableWidget( game );
                widget.CurrentIndex = 0;
                widget.SetEntries( game.Session.Servers );

                widget.SetDrawData( drawer, tableFont, inputFont,
                                   Anchor.LeftOrTop, Anchor.LeftOrTop, tableX, tableY );
                widget.NeedRedraw = MarkPendingRedraw;
                widget.SelectedChanged = SelectedChanged;
                widget.SortDefault();
                widgets[widgetIndex] = widget;
            }

            widget.Height = tableHeight;
            widgetIndex++;
        }
        void ConnectToServer(int mouseX, int mouseY)
        {
            LauncherTableWidget table = (LauncherTableWidget)widgets[tableIndex];

            game.ConnectToServer(table.servers, Get(hashIndex));
        }