Esempio n. 1
0
    private void CalculateSize(MenuParentItem parent)
    {
        this.menuSizeHeight = WindowManager.CharacterHeight * (parent.Items.Count + 2);
        this.menuSizeWidth  = (parent.Items[0].Text.Length << 2) + 8;

        this.menuPosY = ((parent.Items.Count + 3 - this.State.WindowRowMin) * WindowManager.CharacterHeight) - 1;
        this.menuPosX = (parent.Items[0].Column - 1) << 2;
    }
Esempio n. 2
0
    private void DisplaySelected(MenuParentItem parent)
    {
        this.WindowManager.SetTextColor(MenuBackgroundColor, this.GraphicsRenderer.CalculateTextBackground(MenuForegroundColor));
        this.WindowManager.GotoPosition(new TextPosition(parent.Row, parent.Column));

        if (!parent.Enabled)
        {
            this.WindowManager.TextShade = true;
        }

        this.WindowManager.PrintFormatted(parent.Text);
        this.WindowManager.TextShade = false;
    }
Esempio n. 3
0
    public void AppendParentItem(string text)
    {
        byte column = 1;

        foreach (var current in this.Items)
        {
            column += (byte)(current.Text.Length + 1);
        }

        var parentItem = new MenuParentItem();

        parentItem.Column  = column;
        parentItem.Row     = 0;
        parentItem.Text    = text;
        parentItem.Enabled = true;

        this.Items.Add(parentItem);
    }
Esempio n. 4
0
    private void DisplayMenu(MenuParentItem parent)
    {
        this.DisplaySelected(parent);
        this.CalculateSize(parent);
        this.WindowManager.DisplayMessageBoxWindow(new PictureRectangle(this.menuPosX, this.menuPosY, this.menuSizeWidth, this.menuSizeHeight), MenuBackgroundColor, MenuForegroundColor);

        for (int i = 0; i < parent.Items.Count; i++)
        {
            var item = parent.Items[i];
            if (i == parent.SelectedIndex)
            {
                this.DisplaySelected(item);
            }
            else
            {
                this.DisplayUnselected(item);
            }
        }
    }
Esempio n. 5
0
 private void Clear(MenuParentItem parent, MenuItem item)
 {
     parent.SelectedIndex = parent.Items.IndexOf(item);
     this.DisplayUnselected(parent);
     this.GraphicsRenderer.RenderPictureBuffer(new PictureRectangle(this.menuPosX, this.menuPosY, this.menuSizeWidth, this.menuSizeHeight), false, false);
 }