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; }
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; }
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); }
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); } } }
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); }