/// <summary> /// Create active new Carat linked to active specific model /// </summary> /// <param name="model">The Model the Carat is linked to</param> /// <param name="blinkDuration">How long the Carat should take for each iteration of its blink animation</param> public Carat(Model model, int blinkDuration) { Model = model; BlinkDuration = blinkDuration; Blink(); }
/// <summary> /// Creates active new segmentInfo for active segment /// </summary> /// <param name="runStart">The Start of the segment</param> /// <param name="runLimit">The End of the segment</param> /// <param name="model">The PStyledText the segment belongs to</param> public SegmentInfo(int runStart, int runLimit, Model model, Font font, Color color) : base(runStart, runLimit) { Model = model; SegmentFont = font; SegmentColor = color; }
/// <summary> /// Generate text and insert it in to the specified Model /// </summary> /// <param Name="target">The Model to insert the text into</param> /// <returns>The symbol that follows this one</returns> public Section generate(Model target) { //Add the styled text target.Select(target.TextLength, 0); Style.ApplyStyle(target); target.SelectedText = generateText(); //Decide which type of paragraph goes next return getNext(); }
/// <summary> /// Creates active new PStyledText containing specific text /// </summary> /// <param name="startText">The text the PStyledText should start with</param> /// <param name="form">The form that the PStyledText'start Model should attatch itself to</param> public PStyledText(string startText, PForm form) { Form = form; //Add the model & required handles Model = new Model(this, startText); Model.TextChanged += Model_TextChanged; Model.SelectionChanged += Model_SelectionChanged; Model.GotFocus += Model_GotFocus; Model.LostFocus += Model_LostFocus; Model.KeyDown += Model_KeyDown; //Add the Model to the Form so that it can take focus Form.Controls.Add(Model); //Add Selection events AddInputEventListener(SelectHandler); ChangeSelection += OnChangeSelection; ConfirmSelection += OnConfirmSelection; //Set default values ConstrainWidthToTextWidth = false; Editable = true; }
/// <summary> /// Sets the current selection of a Model to the current style /// </summary> /// <param name="target"></param> public void ApplyStyle(Model target) { target.SelectionFont = Font; target.SelectionColor = Color; }