/// <summary> /// Create a new checkbox entity. /// </summary> /// <param name="text">CheckBox label text.</param> /// <param name="anchor">Position anchor.</param> /// <param name="size">CheckBox size.</param> /// <param name="offset">Offset from anchor position.</param> /// <param name="isChecked">If true, this checkbox will be created as 'checked'.</param> public CheckBox(string text, Anchor anchor = Anchor.Auto, Vector2?size = null, Vector2?offset = null, bool isChecked = false) : base(size, anchor, offset) { // update default style UpdateStyle(DefaultStyle); // create and set checkbox paragraph TextParagraph = UserInterface.DefaultParagraph(text, Anchor.CenterLeft); TextParagraph.UpdateStyle(DefaultParagraphStyle); TextParagraph.SetOffset(new Vector2(25, 0)); TextParagraph._hiddenInternalEntity = true; AddChild(TextParagraph, true); // checkboxes are promiscuous by default. PromiscuousClicksMode = true; // set value Checked = isChecked; }