Class: TTextView

Declaration: TextViewCore.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

TContentView, MToolHandler, MMouseEventHandler, MKeyEventHandler, MDropAcceptor

Inherited By:

TSimpleTextView TDocumentTextView

Purpose:

TTextView is an abstract base class that is responsible for displaying the contents of a text representation and for handling mouse and typing events. It creates a TTypingInteractor to handle key events and a TSelectTextInteractor to handle mouse events. TTextView connects for notification with the underlying text representation, and updates the view whenever the text is modified. TTextView provides visual feedback indicating the current text selection. Most of the default behavior can be overridden in protected handle member functions.

Instantiation:

Abstract class; do not instantiate directly.

Deriving Classes:

Most of the default behavior can be overridden in protected handle member functions. The Text Editing Framework classes derived from TTextView are TDocumentTextView and TSimpleTextView. The former is for document component-based text, whereas the latter is not document component-based.

Concurrency:

This class uses the document component entry to support concurrent access.

Resource Use:

No special requirements.

Other Considerations:

None.

Member Function: TTextView::~TTextView

virtual ~ TTextView ()

Interface Category:

API.

Purpose:

Destructor.

Calling Context:

Typically not called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

None.

Member Function: TTextView::GetTextBounds

virtual TGRect GetTextBounds () const

Interface Category:

API.

Purpose:

Returns the current bounds of the text within the view. The bounds take into account the margins around the text as displayed in the view.Called by objects that need to know the size of the text area inside the view and not simply the view size.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

A TGRect representing the text bounds.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

None.

Member Function: TTextView::GetSelectedTextBounds

virtual void GetSelectedTextBounds (const MTextSelection & range, TGArea & area) const

Interface Category:

API.

Purpose:

Returns the area that the specified text selection occupies.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

None.

Member Function: TTextView::GetTextSelection

virtual const MTextSelection * GetTextSelection () const

Interface Category:

API.

Purpose:

Accessor that returns the current selection. Called by functions such as DrawContents that need to know what the current selection is.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

A pointer to the text selection object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

This is a pure virtual function and needs to be overridden.

Member Function: TTextView::CopyCurrentSelection

virtual MTextSelection * CopyCurrentSelection () const

Interface Category:

API.

Purpose:

Creates a copy of the current selection.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

A pointer to the new selection copy.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

This is a pure virtual function and needs to be overridden.

Member Function: TTextView::AdoptCurrentSelection

virtual void AdoptCurrentSelection (MTextSelection *)

Interface Category:

API.

Purpose:

Adopts the specified selection.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

This is a pure virtual function and needs to be overridden.

Member Function: TTextView::GetTextRepresentation

virtual MTextRepresentation * GetTextRepresentation () const

Interface Category:

API.

Purpose:

Accessor that retrieves the text representation for the view. Called by functions such as SetCurrentSelection that need the representation object in order to call its relevant member functions.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

A pointer to the MTextRepresentation.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

This is a pure virtual function and needs to be overridden.

Member Function: TTextView::operator>>=

virtual TStream & operator >>=(TStream &) const

Interface Category:

API.

Purpose:

Stream-out operator.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

Returns a reference to the stream the object streams itself out to.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

None.

Member Function: TTextView::operator<<=

virtual TStream & operator <<= (TStream &)

Interface Category:

API.

Purpose:

Stream-in operator.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

Returns a reference to the stream the object streams itself in from.

Exceptions:

Throws TInvalidVersionError if the object has detected an unsupportable version during the stream-in process.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

None.

Member Function: TTextView::DrawContents

virtual void DrawContents (TGrafPort &) const

Interface Category:

API.

Purpose:

Draws the contents of the associated text representation using the appearance settings of the associated text presenter state. Gets read lock on the representation and then calls HandleDrawBackground to draw the background, HandleDrawText to draw the text, and finally HandleDrawSelection to draw the text caret and selection area. At the end, if a typing interactor exists, a typing request is posted.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

Overrides inherited TContentView function.

Member Function: TTextView::SetAllocatedArea

  1. virtual void SetAllocatedArea (const TGArea &)
  2. virtual void SetAllocatedArea (const TGRect &)

Interface Category:

API.

Purpose:

  1. Resets the bounds of the view. Uses the associated formatter to post a panel change notification, causing the text to be reformatted and redrawn.
  2. Converts the TGRect to a TGArea and calls 1.

Calling Context:

  1. May be called directly by clients.
  2. May be called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

Overrides inherited TContentView function.

Member Function: TTextView::TransformAllocatedAreaInParentBy

virtual void TransformAllocatedAreaInParentBy (const TGrafMatrix &)

Interface Category:

API.

Purpose:

Transforms the bounds of the view because the view was moved to a new location in the parent view. Causes the text to be reformatted and redrawn.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

Overrides inherited TContentView function.

Member Function: TTextView::CreateToolTarget

virtual MToolTarget * CreateToolTarget (const TTypeDescription &, const TGPoint &) const

Interface Category:

API.

Purpose:

Creates a target for a tool interactor based on this view. By default, this function returns NIL; derived classes should override.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

A pointer to the tool target.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

Overrides inherited MToolHandler function. Derived classes should override.

Member Function: TTextView::CreateToolInteractor

virtual TToolInteractor * CreateToolInteractor (const TGPoint &, const TToken & hint) const

Interface Category:

API.

Purpose:

Creates a tool interactor.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

The tool interactor created.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

Overrides inherited MToolHandler function.

Member Function: TTextView::AdoptAndDo

virtual void AdoptAndDo (TToolCommandBinding *)

Interface Category:

API.

Purpose:

This is a pure virtual function; derived classes must override this MToolHandler override to adopt the specified tool command binding, and do the command.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

Overrides inherited MToolHandler function. This is a pure virtual function and needs to be overridden.

Member Function: TTextView::DoBegin

virtual void DoBegin (TToolCommandBinding &)

Interface Category:

API.

Purpose:

This is a pure virtual function; derived classes should call the specified binding's appropriate function to begin command processing.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

Overrides inherited MToolHandler function. This is a pure virtual function and needs to be overridden.

Member Function: TTextView::DoIncrement

virtual void DoIncrement (TToolCommandBinding &)

Interface Category:

API.

Purpose:

This is a pure virtual function; derived classes should call the specified binding's appropriate function to do incremental command processing.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

Overrides inherited MToolHandler function. This is a pure virtual function and needs to be overridden.

Member Function: TTextView::AdoptAndDoEnd

virtual void AdoptAndDoEnd (TToolCommandBinding *)

Interface Category:

API.

Purpose:

This is a pure virtual function; derived classes should call the specified binding's appropriate function to adopt the tool command binding and complete command processing.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

Overrides inherited MToolHandler function. This is a pure virtual function and needs to be overridden.

Member Function: TTextView::MouseDown

virtual bool MouseDown (TMouseDownEvent &)

Interface Category:

API.

Purpose:

Handles the mouse down event by ending any current typing interactor and creating and starting either a new selection interactor (a TSelectTextInteractor) or a drag drop interactor.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

Always returns true.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

Overrides inherited MMouseEventHandler function.

Member Function: TTextView::MouseEntered

virtual bool MouseEntered (TMouseMovedEvent & mouseEnter)

Interface Category:

API.

Purpose:

Handles activating mouse tracking across this view.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

Returns false, which enables the cursor tools to have the event.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

Overrides inherited MMouseEventHandler function.

Member Function: TTextView::MouseExited

virtual bool MouseExited (TMouseMovedEvent & mouseExit)

Interface Category:

API.

Purpose:

Handles the event indicating that mouse tracking in the view has ended.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

Returns false, which enables the cursor tools to have the event.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

Overrides inherited MMouseEventHandler function.

Member Function: TTextView::KeyDown

virtual bool KeyDown (TKeyDownEvent &)

Interface Category:

API.

Purpose:

Handles key events. Starts the typing interactor for the view if one exists and isn't already active. Does nothing if the typing interactor for the view is NIL.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

Returns true if the interactor exists and was started. Otherwise returns false.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

None.

Member Function: TTextView::CoordinateToInsertionOffset

virtual void CoordinateToInsertionOffset (const TGPoint & coordinateToConvert, TInsertionOffset & resultOffset) const

Interface Category:

API.

Purpose:

Converts a coordinate position within the view into an insertion offset within the text representation.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

None.

Member Function: TTextView::InsertionOffsetToCoordinate

virtual TGPoint InsertionOffsetToCoordinate (const TInsertionOffset & insertionOffsetToConvert) const

Interface Category:

API.

Purpose:

Converts an insertion offset within the text representation into a coordinate position within the view.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

A TGPoint containing the coordinate of the appropriate mouse position.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

None.

Member Function: TTextView::TTextView

  1. TTextView ()
  2. TTextView (const TTextView &)

Interface Category:

API.

Purpose:

  1. Default constructor. This constructor is protected.
  2. Copy constructor. This constructor is protected.

Calling Context:

  1. Only for internal use by Resurrect. Developers should treat as protected.
  2. Only for internal use by Copy. Developers should treat as protected.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

None.

Member Function: TTextView::operator=

TTextView & operator =(const TTextView &)

Interface Category:

API.

Purpose:

Assignment operator.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

A non-const reference to the left-hand side object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

This function is protected.

Member Function: TTextView::GetFormatter

virtual TAbstractPanelFormatter * GetFormatter () const

Interface Category:

API.

Purpose:

Returns the formatter for this view. Calls HandleCreateFormatter to create and initialize the formatter if one is not yet associated with the view.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

A pointer to the abstract panel formatter for this view.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

This function is protected.

Member Function: TTextView::GetBackgroundBundle

const TAttributeState * GetBackgroundBundle () const

Interface Category:

API.

Purpose:

Retrieves the background bundle associated with this view. Called by functions that need access to the background bundle, for example, for information about the color to be used to draw the background.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

A pointer to the TAttributeState background bundle.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

None.

Member Function: TTextView::GetSelectionBundle

const TAttributeState * GetSelectionBundle () const

Interface Category:

API.

Purpose:

Retrieves the selection bundle associated with this view. Called by functions that need access to the selection bundle, for example, for information about the color to be used to draw the selection.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

A pointer to the TAttributeState selection bundle.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

None.

Member Function: TTextView::GetCaretBundle

const TAttributeState * GetCaretBundle () const

Interface Category:

API.

Purpose:

Retrieves the caret bundle associated with this view. Called by functions that need access to the caret bundle, for example, for information needed to draw the caret .

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

A pointer to the TAttributeState caret bundle.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

None.

Member Function: TTextView::AdoptBackgroundBundle

virtual void AdoptBackgroundBundle (TAttributeState *)

Interface Category:

API.

Purpose:

Allows changing the background bundle associated with the view. The old background bundle is deleted.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

None.

Member Function: TTextView::AdoptSelectionBundle

virtual void AdoptSelectionBundle (TAttributeState *)

Interface Category:

API.

Purpose:

Allows changing the selection bundle associated with the view. The old selection bundle is deleted.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

None.

Member Function: TTextView::AdoptCaretBundle

virtual void AdoptCaretBundle (TAttributeState *)

Interface Category:

API.

Purpose:

Allows changing the caret bundle associated with the view. The old caret bundle is deleted.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

None.

Member Function: TTextView::HandleConnectForNotification

virtual void HandleConnectForNotification ()

Interface Category:

API.

Purpose:

Sets this view up to receive text change notifications from the representation.

Calling Context:

Called when the view is initialized. Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

This function is protected.

Member Function: TTextView::HandleDisconnectNotification

virtual void HandleDisconnectNotification ()

Interface Category:

API.

Purpose:

Disconnects the notification connection; the view will no longer receive text change notification. Called before the view is disconnected from the view hierarchy.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

This function is protected.

Member Function: TTextView::HandleTextChanged

virtual void HandleTextChanged (const TNotification &)

Interface Category:

API.

Purpose:

Handles receipt of notification that text changed. Notifies the formatter of changes to the text.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

This function is protected.

Member Function: TTextView::HandleTextSelectionChanged

virtual void HandleTextSelectionChanged (const MTextSelection & newSelection)

Interface Category:

API.

Purpose:

Handles receipt of notification that the text selection changed. Calls HandleDrawSelection to draw the new selection.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

This function is protected.

Member Function: TTextView::HandlePanelChanged

virtual void HandlePanelChanged ()

Interface Category:

API.

Purpose:

Handles receipt of notification that the panel changed. Notifies the formatter of the panel change.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

This function is protected.

Member Function: TTextView::HandleCreateBackgroundBundle

virtual TAttributeState * HandleCreateBackgroundBundle () const

Interface Category:

API.

Purpose:

Creates and returns a background bundle with white as the background color.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

A pointer to the new background bundle.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

This function is protected.

Member Function: TTextView::HandleCreateSelectionBundle

virtual TAttributeState * HandleCreateSelectionBundle () const

Interface Category:

API.

Purpose:

Creates and returns a selection bundle with white as the background color and yellow as the selection color.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

A pointer to the new selection bundle.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

This function is protected.

Member Function: TTextView::HandleCreateCaretBundle

virtual TAttributeState * HandleCreateCaretBundle () const

Interface Category:

API.

Purpose:

Creates and returns a caret bundle with white as the background color and red as the caret color.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

A pointer to the new caret bundle.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

This function is protected.

Member Function: TTextView::HandleDrawBackground

virtual void HandleDrawBackground (TGrafPort & port, const TGArea & damagedArea) const

Interface Category:

API.

Purpose:

Draws the background for the area that needs to be redrawn.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

This function is protected.

Member Function: TTextView::HandleDrawText

virtual void HandleDrawText (TGrafPort & port, const TGArea & damagedArea) const

Interface Category:

API.

Purpose:

Draws the text in the area that needs to be redrawn. Invokes the formatter to do the drawing.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

This function is protected.

Member Function: TTextView::HandleDrawSelection

virtual void HandleDrawSelection (TGrafPort & port, const TGArea & selectedArea, bool isCaret) const

Interface Category:

API.

Purpose:

Draws the specified selected area of text. Invokes either HandleDrawCaret or HandleDrawHighlight to do the drawing, depending on the value of isCaret.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

This function is protected.

Member Function: TTextView::HandleDrawHighlight

virtual void HandleDrawHighlight (TGrafPort & port, const TGArea & damagedArea) const

Interface Category:

API.

Purpose:

Draws the highlight region indicating the current text selection.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

This function is protected.

Member Function: TTextView::HandleDrawCaret

virtual void HandleDrawCaret (TGrafPort & port, const TGArea & damagedArea) const

Interface Category:

API.

Purpose:

Draws the caret in the area that needs to be redrawn.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

This function is protected.

Member Function: TTextView::HandleCreateTypingInteractor

virtual TTypingInteractor * HandleCreateTypingInteractor ()

Interface Category:

API.

Purpose:

Pure virtual function for creating the typing interactor for this view.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

A pointer to the new typing interactor.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

This function is protected. This is a pure virtual function and needs to be overridden.

Member Function: TTextView::HandleCreateSelectTextInteractor

virtual TSelectTextInteractor * HandleCreateSelectTextInteractor ()

Interface Category:

API.

Purpose:

Creates the select text interactor for this view.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

A pointer to the new TSelectTextInteractor.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

This function is protected.

Member Function: TTextView::StopTypingInteractor

virtual void StopTypingInteractor ()

Interface Category:

API.

Purpose:

Stops the typing interactor for this view if one has been started.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

None.

Member Function: TTextView::HandleActivate

virtual void HandleActivate ()

Interface Category:

API.

Purpose:

Handles activation of this view. Creates a new typing interactor.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

None.

Member Function: TTextView::HandleDeactivate

virtual void HandleDeactivate ()

Interface Category:

API.

Purpose:

Handles deactivation of this view. Ends the typing interactor if it is active.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

None.

Member Function: TTextView::HandleDroppedGraphic

virtual void HandleDroppedGraphic (const TGPoint & whereDropped, MGraphic * graphicToAdopt)

Interface Category:

API.

Purpose:

Handles the situation where a graphic has been dropped into the view. The default implementation inserts the graphic as a character; derived classes may override to change the behavior.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

This function is protected.

Member Function: TTextView::HandleDroppedTextModel

virtual void HandleDroppedTextModel (const TGPoint & whereDropped, TTextModel * modelToAdopt)

Interface Category:

API.

Purpose:

Handles the situation where a text model has been dropped into the view. The default implementation calls HandleDroppedText with the model's text.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

This function is protected.

Member Function: TTextView::HandleDroppedText

virtual void HandleDroppedText (const TGPoint & whereDropped, const TText & item)

Interface Category:

API.

Purpose:

Handles the situation where text has been dropped into the view. This is a pure virtual function that must be overridden.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

This function is protected. This is a pure virtual function and needs to be overridden.

Member Function: TTextView::HandleCreateScrapItem

virtual TScrapItem * HandleCreateScrapItem () const

Interface Category:

API.

Purpose:

Creates a scrap item for use with drag and drop. By default, creates a TScrapItemOn<TText>. Model-derived classes should override to create a model scrap item.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

A pointer to the TScrapItem, by default a TScrapItemOn<TText>.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

This function is protected.

Member Function: TTextView::GetDragCursorGraphic

virtual const MGraphic * GetDragCursorGraphic () const

Interface Category:

API.

Purpose:

Retrieves the drag cursor graphic, a sideways arrow.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

A pointer to the drag cursor graphic.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

This function is protected.

Member Function: TTextView::HandleCreateDragGraphic

virtual MGraphic * HandleCreateDragGraphic () const

Interface Category:

API.

Purpose:

Creates a drag graphic that is the text with a box around it.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

A pointer to the drag graphic.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

This function is protected.

Member Function: TTextView::IsDragSelection

virtual bool IsDragSelection (TMouseDownEvent & mouseDown)

Interface Category:

API.

Purpose:

Returns true if the mouse-down position is within the current selection.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

Returns true if the mouse-down position is within the current selection.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

This function is protected.

Member Function: TTextView::HandleCreateDragAndDropInteractor

virtual TInteractor * HandleCreateDragAndDropInteractor ()

Interface Category:

API.

Purpose:

Creates a drag and drop interactor.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

A pointer to the new drag and drop interactor.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

None.

Member Function: TTextView::HandleCreateFormatter

virtual TAbstractPanelFormatter * HandleCreateFormatter ()

Interface Category:

API.

Purpose:

Creates a new panel formatter.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

A pointer to the new panel formatter.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

This function is protected.

Member Function: TTextView::HandleCreateNavigationKeysBehavior

virtual MEventTarget * HandleCreateNavigationKeysBehavior ()

Interface Category:

API.

Purpose:

Creates and returns a new behavior for navigation keys (i.e., up,down,left,right) for the view.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

A pointer to the new TCursorKeyTarget.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

This function is protected.

Member Function: TTextView::FindNextInsertionOffset

virtual TInsertionOffset FindNextInsertionOffset (const TInsertionOffset & currentOffset, TAbstractPanelFormatter :: EDirectionToMove inputDirection, TAbstractPanelFormatter :: EAmountToMove inputAmount =TAbstractPanelFormatter :: kOnePosition, const TTextRange & inputApplicableRange =TTextRange :: GetMaximumRange (), const TGPoint & inputAlignmentPoint =TGPoint ( -kInfinity, -kInfinity )) const

Interface Category:

API.

Purpose:

Returns the TInsertionOffset position one character/line up, down, left, or right from the current insertion offset in the text.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

The newly created TInsertionOffset.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

None.

Member Function: TTextView::AcceptDrop

virtual bool AcceptDrop (const TGPoint & whereDropped, const TTypeDescription & theType, const TScrapItem & theItem)

Interface Category:

API.

Purpose:

Handles the situation where an item (theItem) of type theType has been dragged and dropped at location whereDropped in the view. Calls HandleDroppedText, HandleDroppedTextModel, or HandleDroppedGraphic, as appropriate.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

Returns true if the item type is a known item type.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

Overrides inherited MDropAcceptor function.

Member Function: TTextView::ChoosePreferredType

virtual bool ChoosePreferredType (const TGPoint & whereDropped, const TSequenceOf < TTypeDescription > & availableTypes, TTypeDescription & chosenType) const

Interface Category:

API.

Purpose:

Sets chosenType to the preferred type description, based on the sequence of available types.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

Returns true if an appropriate type description was found.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

None.

Member Function: TTextView::DispatchEvent

virtual bool DispatchEvent (TEvent & theEvent)

Interface Category:

API.

Purpose:

Gives the cursor tools an opportunity to handle the event. If they don't handle it, then DispatchEvent calls the DispatchEvent function of TDocumentComponentView to handle the event.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

Returns true if the event is handled by either the cursor tools or the document component view.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

None.

Member Function: TTextView::HandleBeforeDisconnectionFromViewRoot

virtual void HandleBeforeDisconnectionFromViewRoot ()

Interface Category:

API.

Purpose:

Performs actions required before disconnecting from the view root. This includes calling HandleDisconnectNotification.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

None.

Member Function: TTextView::HandleAfterConnectionToViewRoot

virtual void HandleAfterConnectionToViewRoot ()

Interface Category:

API.

Purpose:

Performs setup actions required after connection to the view root. This includes calling HandleConnectForNotification, setting up for handling cursor tools, initializing the arrow tool, setting up for receiving mouse events, calling HandleCreateFormatter if a formatter is not yet associated with the view, and initializing the drawing bundles by calling HandleCreate(Selection/Background/Caret)Bundle.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

None.

Member Function: TTextView::GetFilteredRepresentation

virtual TFilteredTextRepresentation * GetFilteredRepresentation ()

Interface Category:

API.

Purpose:

Accessor that retrieves the filtered text representation for the view.

Calling Context:

Called by the Text Framework classes. Typically not called directly by clients.

Parameters:

Return Value:

A pointer to the TFilteredTextRepresentation.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

This is a pure virtual function and needs to be overridden.

Member Function: TTextView::SetCurrentSelection

void SetCurrentSelection (const TTextArea & area)

Interface Category:

API.

Purpose:

Sets the current selection to the specified text area.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

This is a pure virtual function and needs to be overridden.

Member Function: TTextView::GetCurrentSelectedArea

virtual void GetCurrentSelectedArea (TGArea & area) const

Interface Category:

API.

Purpose:

Copies the current selection, then calls GetSelectedTextBounds to determine the area comprising the selection.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

None.

Member Function: TTextView::GetMarginAdjustedArea

virtual TGRect GetMarginAdjustedArea () const

Interface Category:

API.

Purpose:

Returns the view's allocated area, adjusted by any margin.

Calling Context:

May be called directly by clients.

Parameters:

Return Value:

The TGRect for the allocated area, adjusted by any margin

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component entry to support access.

Other Considerations:

None.

Member Function: TTextView::NeedsClipping

virtual bool NeedsClipping ()

Interface Category:

API.

Purpose:

TContentView override. Called by the View system during damage repair. The port is set up as in DrawContents. However, it is also clipped to the area to be repaired if the view's NeedsClipping function returned true. Developers can use this fact to optimize their drawing if they so choose.

Calling Context:

Called by the View system during damage repair. Typically not called directly by clients.

Parameters:

Return Value:

Returns true if view needs clipping, otherwise returns false.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component.

Other Considerations:

None.

Member Function: TTextView::DrawNewSelection

virtual void DrawNewSelection (const TTextArea &)

Interface Category:

API.

Purpose:

Draw the selection specified by the given text area.

Calling Context:

May be called directly. Called by Text Editing Framework.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

This class uses the document component.

Other Considerations:

None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.