private void InitTextWindow() { UIScrollWindow textWindow = new UIScrollWindow(); textWindow.Location = new Vector2(300, 300); textWindow.ScrollPanel.Restriction = ScrollRestriction.Vertical; textWindow.Size = new Vector2(180); textWindow.AddConstraint(Edge.Horizontal | Edge.Bottom, null, Edge.Horizontal | Edge.Bottom, 5, ConstraintCategory.Initialization); string str = "A multiline UILabel in a UIScrollPanel. "; for (int i = 0; i < 6; i++) { str += str; } UILabel label = new UILabel(str, true); label.AddConstraint(Edge.TopLeft, textWindow.ScrollPanel, Edge.TopLeft, ConstraintCategory.Initialization); label.AddConstraint(Edge.Right, textWindow.ScrollPanel, Edge.Right, ConstraintCategory.Initialization); textWindow.AddChild(label); uiManager.Add(textWindow); }
private UIControl GetMenuEntry(UIControl parent, string label) { var control = new UIButton(); control.InputReleased += control_InputPressed; //var uiImg = new UIImage( "graphics/arrow_down" ); //uiImg.AddConstraint( Edge.CenterXY, control, Edge.CenterXY ); //control.AddDecoration( uiImg ); var uiLabel = new UILabel(label); uiLabel.AddConstraint(Edge.CenterXY, control, Edge.CenterXY); control.AddDecoration(uiLabel); control.AddConstraint(Edge.CenterX, parent, Edge.CenterX); if (previousEntry == null) { control.AddConstraint(Edge.CenterY, parent, Edge.CenterY, 0, ConstraintCategory.Initialization); } else { control.AddConstraint(Edge.Top, previousEntry, Edge.Bottom, -20, ConstraintCategory.Initialization); } previousEntry = control; return(control); }
private void InitTextWindow() { UIScrollWindow textWindow = new UIScrollWindow(); textWindow.Position = new Vector2(300, 300); textWindow.ScrollPanel.Restriction = ScrollRestriction.Vertical; textWindow.Size = new Vector2(0, 180); textWindow.AddConstraint(Edge.Bottom, null, Edge.Bottom, 5); textWindow.AddConstraint(Edge.Horizontal, null, Edge.Horizontal, 5); string text = NativeFile.ReadAllText(Path.Combine(Environment.CurrentDirectory, "Lorem Ipsum.txt")); UILabel label = new UILabel(text, true); label.AddConstraint(Edge.TopLeft, textWindow.ScrollPanel, Edge.TopLeft, ConstraintCategory.Initialization); label.AddConstraint(Edge.Right, textWindow.ScrollPanel, Edge.Right, ConstraintCategory.Initialization); textWindow.AddChild(label); uiManager.Add(textWindow); }
public UILabelCheckBox(string label, string checkmarkResource = "graphics/checkmark") { Alpha = 0f; var uiLabel = new UILabel(label); CheckBox = new UICheckBox(checkmarkResource); uiLabel.AddConstraint(Edge.Left, this, Edge.Left); CheckBox.AddConstraint(Edge.Left, uiLabel, Edge.Right, -10); AddChild(uiLabel); AddChild(CheckBox); }