struct CCL::ITextModel

Overview

Text model interface for use in a TextBox and EditBox. More…

#include <itextmodel.h>

struct ITextModel: public CCL::IUnknown
{
    // enums

    enum EditOptions;

    // structs

    struct DrawInfo;
    struct InteractionInfo;

    // methods

    virtual void CCL_API toDisplayString (String& string) const = 0;
    virtual void CCL_API updateLayout (ITextLayout& layout) = 0;

    virtual int CCL_API insertText (
        int textIndex,
        StringRef text,
        EditOptions options
    ) = 0;

    virtual int CCL_API removeText (int textIndex, int length, EditOptions options) = 0;
    virtual void CCL_API copyText (String& text, int textIndex = 0, int length = -1) const = 0;
    virtual tbool CCL_API undo () = 0;
    virtual tbool CCL_API redo () = 0;

    virtual tbool CCL_API drawBackground (
        const ITextLayout& layout,
        const DrawInfo& info
    ) = 0;

    virtual tbool CCL_API onTextInteraction (
        const ITextLayout& layout,
        const InteractionInfo& info
    ) = 0;

    virtual void CCL_API toParamString (String& string) const = 0;
    virtual void CCL_API fromParamString (StringRef string) = 0;
    DECLARE_STRINGID_MEMBER (kRequestLayoutUpdate);
};

Inherited Members

public:
    // methods

    virtual tresult CCL_API queryInterface (UIDRef iid, void** ptr) = 0;
    virtual unsigned int CCL_API retain () = 0;
    virtual unsigned int CCL_API release () = 0;

Detailed Documentation

Text model interface for use in a TextBox and EditBox.

Methods

virtual void CCL_API toDisplayString (String& string) const = 0

Get plain string representation for display (without formatting).

virtual void CCL_API updateLayout (ITextLayout& layout) = 0

Update text layout with formatting.

virtual int CCL_API insertText (
    int textIndex,
    StringRef text,
    EditOptions options
) = 0

Insert text into data model at given display text index.

Returns the number of inserted characters and signals kChanged if successful.

virtual int CCL_API removeText (int textIndex, int length, EditOptions options) = 0

Remove text from data model at given display text index.

Returns the number of removed characters and signals kChanged if successful. The length argument may be negative if the text should be removed backwards from the given index.

virtual void CCL_API copyText (String& text, int textIndex = 0, int length = -1) const = 0

Copy a range of text in a representation that is accepted as input for insertText.

virtual tbool CCL_API undo () = 0

Undo the last change.

Returns true if the last change was caused by the text model and signals kChanged if successful.

virtual tbool CCL_API redo () = 0

Redo the next change.

Returns true if the next change was caused by the text model and signals kChanged if successful.

virtual tbool CCL_API drawBackground (
    const ITextLayout& layout,
    const DrawInfo& info
) = 0

Draw additional background.

virtual tbool CCL_API onTextInteraction (
    const ITextLayout& layout,
    const InteractionInfo& info
) = 0

Text interaction notification.

virtual void CCL_API toParamString (String& string) const = 0

Get string representation for use in a parameter.

virtual void CCL_API fromParamString (StringRef string) = 0

Restore text from string representation of parameter.

Signals kChanged if successful.