// c'tor public TextLineEditor(AABB2D location, string original, string iconName = null) { TextLineEditor.Instance = this; shared = new Shared(this); shared.location = location; // Set the hit box for the text area. shared.textAreaHitBox.Set(shared.location); // Create the RenderObject and UpdateObject parts of this mode. updateObj = new UpdateObj(this, shared); renderObj = new RenderObj(shared); shared.blob = new TextBlob(renderObj.Font, (null != original) ? original : "", shared.textWidth); shared.blob.Justification = UIGridElement.Justification.Left; shared.blob.End(); shared.topLine = 0; shared.textOffset = 0; shared.iconName = iconName; // We use the updateObj for this deserialization since the text callbacks // belong to it. Otherwise nothing will ever hook up right. //commandMap = CommandMap.Deserialize(updateObj, @"TextEditor.Xml"); } // end of TextEditor c'tor
public TextLineDialog(string initalText = "") { camera.Resolution = new Point(1280, 720); var center = new Vector2(640, 360); var min = center - new Vector2(dialogWidth / 2, dialogHeight / 2); var max = center + new Vector2(dialogWidth / 2, dialogHeight / 2); //Create text control var margin = new Vector2(10, 0);//inset text control a bit textBox = new AABB2D(min + new Vector2(0, headerHeight) + margin, max - new Vector2(0, footerHeight) - margin); textLineEditor = new TextLineEditor(textBox, initalText); }
// c'tor public Shared(TextLineEditor parent) { this.parent = parent; } // end of Shared c'tor
public UpdateObj(TextLineEditor parent, Shared shared) { this.parent = parent; this.shared = shared; }