public override void InitialiseControls() { var horizontalAlignment = Menu.Centred ? HorizontalAlignment.Center : HorizontalAlignment.Left; var verticalAlignment = Menu.Centred ? VerticalAlignment.Center : VerticalAlignment.Top; var background = new BackgroundControl { Position = Position, Padding = Padding, HorizontalAlignment = horizontalAlignment, VerticalAlignment = verticalAlignment }; Controls.Add(background); MenuActions = new MenuActionsControl { AvailableActions = Menu.AvailableActions, SelectedAction = Menu.SelectedAction, SelectedColor = Color.Blue, VerticalAlignment = VerticalAlignment.Top, HorizontalAlignment = HorizontalAlignment.Right }; background.Controls.Add(MenuActions); var topFlow = new FlowContainerControl { HorizontalAlignment = horizontalAlignment, VerticalAlignment = verticalAlignment, ShrinkToContents = true }; var titleText = new LargeTextControl { Parameters = Menu.MenuName }; topFlow.Controls.Add(titleText); var lineControl = new LineControl(); topFlow.Controls.Add(lineControl); background.Controls.Add(topFlow); PagedMenuControl = new PagedMenuControl { MenuItems = Menu.MenuItems, SelectedItem = Menu.SelectedItem, ShrinkToContents = true, Margin = new Padding(4, 1, 1, 1), HorizontalAlignment = horizontalAlignment, VerticalAlignment = verticalAlignment }; topFlow.Controls.Add(PagedMenuControl); }
public override void InitialiseControls() { backgroundControl = new BackgroundControl { Position = Position, Padding = new Padding(3) }; var topFlow = new FlowContainerControl { FlowDirection = FlowDirection.BottomUp, VerticalAlignment = VerticalAlignment.Bottom }; var downFlow = new FlowContainerControl { FlowDirection = FlowDirection.TopDown, VerticalAlignment = VerticalAlignment.Top }; ShopItemsFlow = new FlowContainerControl { FlowDirection = FlowDirection.LeftToRight }; titleControl = new LargeTextControl { Parameters = this.shop.DescriptionName }; exitButton = new ButtonControl { Position = new Rectangle(), Text = "Exit" }; exitButton.OnClick += ExitButton_OnClick; Controls.Add(backgroundControl); backgroundControl.Controls.Add(topFlow); topFlow.Controls.Add(exitButton); topFlow.Controls.Add(downFlow); downFlow.Controls.Add(titleControl); downFlow.Controls.Add(new Spacer()); downFlow.Controls.Add(ShopItemsFlow); RefreshShopItemControls(); }
public override void InitialiseControls() { var backgroundControl = new BackgroundControl { Position = Position, Padding = Padding }; var topFlow = new FlowContainerControl { Position = Position, ShrinkToContents = true }; var titleText = new LargeTextControl { Parameters = Form.Title }; topFlow.Controls.Add(titleText); var lineControl = new LineControl(); topFlow.Controls.Add(lineControl); var buttonFlowContainer = new FlowContainerControl { Position = Position, FlowDirection = FlowDirection.BottomUp, VerticalAlignment = VerticalAlignment.Bottom, ShrinkToContents = true }; var buttonFlow = new FlowContainerControl { Position = Position, FlowDirection = FlowDirection.LeftToRight, ShrinkToContents = true, VerticalAlignment = VerticalAlignment.Bottom }; buttonFlowContainer.Controls.Add(buttonFlow); Buttons = new List <ButtonControl>(); foreach (var button in Form.Buttons.GetFlags()) { var buttonControl = new ButtonControl { Text = button.ToString(), Margin = new Padding(2) }; buttonControl.OnClick += FormButtonControl_OnClick; buttonFlow.Controls.Add(buttonControl); Buttons.Add(buttonControl); } FormControls = new List <FormData>(); foreach (var formField in Form.Fields) { var nameText = new TextControl { Parameters = formField.Key + ": " }; var formFieldControl = formField.Value; formFieldControl.OnClick += FormFieldControl_OnClick; FormControls.Add(formFieldControl); var subFlow = new FlowContainerControl { FlowDirection = FlowDirection.LeftToRight, ShrinkToContents = true, Margin = new Padding { Top = 1 } }; subFlow.Controls.Add(nameText); subFlow.Controls.Add(formFieldControl); topFlow.Controls.Add(subFlow); } Controls.Add(backgroundControl); backgroundControl.Controls.Add(topFlow); backgroundControl.Controls.Add(buttonFlow); }