/* PROPERTIES */ // Add element(s) to the UIElements list public void Add(UIElement element) { UIElements.Add(element); }
// Draws an element at the specified left and top positions private void drawElement(UIElement element, int leftPos, int topPos, bool drawHighlighted) { // Set the cursor position to this element's respective x and y coordinates Console.SetCursorPosition(leftPos, topPos); // Handle drawing each element differently // If it's a spacer if (element is Spacer) { // Don't do anything! Spacers have nothing to write } else if (element is Label) { // Temporarily unbox the label Label tempLabel = (Label)element; // Write the element if (drawHighlighted) { HighlighterPrint(tempLabel.Title); } else { Console.Write(tempLabel.Title); } } else if (element is SelectionBox) { // Temporarily unbox the selection box SelectionBox tempSelectionBox = (SelectionBox)element; // Draw the label/title of this selection box Console.Write(tempSelectionBox.Title + " "); // Write the element if (drawHighlighted) { HighlighterPrint(tempSelectionBox.Choices[tempSelectionBox.SelectedChoiceIndex]); } else { Console.Write(tempSelectionBox.Choices[tempSelectionBox.SelectedChoiceIndex]); } } else if (element is Button) { // Temporarily unbox the element Button tempButton = (Button)element; if (drawHighlighted) { HighlighterPrint(tempButton.Title); } else { Console.Write(tempButton.Title); } } }