Class: TSelectTextInteractor

Declaration: TextInteractorsCore.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

TInteractor, MMouseEventHandler

Inherited By:

None.

Purpose:

TSelectTextInteractor, derived from TInteractor and MMouseEventHandler, is used by the Text Editing Framework to handle selection of text by clicking and dragging the mouse. TSelectTextInteractor creates both insertion point and text range selections on the current text representation, and causes the view to be redrawn with the new selection.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

This class is designed to be used directly.

Concurrency:

Multithread safe.

Resource Use:

No special requirements.

Other Considerations:

None.

Member Function: TSelectTextInteractor::TSelectTextInteractor

  1. TSelectTextInteractor (TTextView * view)
  2. TSelectTextInteractor (const TSelectTextInteractor & interactor)
  3. TSelectTextInteractor ()

Interface Category:

API.

Purpose:

  1. Constructs a mouse interactor for the specified view.
  2. Copy constructor.
  3. Default constructor. This constructor is protected.

Calling Context:

  1. Call to construct a mouse interactor for a particular view.
  2. Called to copy an object.
  3. Only for internal use by Resurrect. Developers should treat as protected.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TSelectTextInteractor::~TSelectTextInteractor

virtual ~ TSelectTextInteractor ()

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:

Multithread safe.

Other Considerations:

None.

Member Function: TSelectTextInteractor::MouseDown

virtual bool MouseDown (TMouseDownEvent & mouseDown)

Interface Category:

API.

Purpose:

Handles the event that occurs when the user pushes down the mouse button. Sets up for the mouse dragging to follow, and maps the mouse down position to an insertion point within the text as it is displayed in the text view. If user did a Shift-click, calls HandleExtendTextSelection. If user double-clicked, calls HandleSelectWord, and if user did a triple-click, calls HandleSelectLine.

Calling Context:

Called by the framework when a mouse-down event occurs. Typically not called directly by clients.

Parameters:

Return Value:

Returns true when finished handling the event.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TSelectTextInteractor::MouseUp

virtual bool MouseUp (TMouseUpEvent & mouseUp)

Interface Category:

API.

Purpose:

Handles the event that occurs when the user lets the mouse button up. This function maps the mouse up position to an insertion point if it is the same as the last mouse down position. Otherwise, it maps the mouse up position to a range based on the last mouse down position. Sets the new selection in the text presenter state, which causes the view to be updated.

Calling Context:

Called by the framework when a mouse-up event occurs. Typically not called directly by clients.

Parameters:

Return Value:

Returns true when finished handling the event.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TSelectTextInteractor::MouseMoved

virtual bool MouseMoved (TMouseMovedEvent & mouseMoved)

Interface Category:

API.

Purpose:

Tracks mouse movement for click and drag behavior. Sets the new selection on the representation based on the current position of the mouse, and sets the new selection in the presenter state, which causes the view to be updated. Provides visual feedback when creating selections.

Calling Context:

Called by the framework at various intervals when the mouse is down and is being dragged. Typically not called directly by clients.

Parameters:

Return Value:

Returns true when finished handling the event.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TSelectTextInteractor::ComputeNewSelection

virtual void ComputeNewSelection (const TInsertionOffset & previousPoint, const TInsertionOffset & newPoint, TTextArea & newSelection) const

Interface Category:

API.

Purpose:

Sets newSelection argument to the new selection, computed based on the previous and new insertion point offsets.

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:

Multithread safe.

Other Considerations:

This function is protected.

Member Function: TSelectTextInteractor::HandleExtendTextSelection

virtual void HandleExtendTextSelection (TMouseDownEvent & mouseDown)

Interface Category:

API.

Purpose:

Extends the current selection to the position where the mouse down event occurred. Called by MouseDown when user does a Shift-click.

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:

Multithread safe.

Other Considerations:

None.

Member Function: TSelectTextInteractor::HandleSelectLine

virtual void HandleSelectLine (const TTextOffset &)

Interface Category:

API.

Purpose:

Selects the line of text that includes that at the specified offset. Called by MouseDown when the user does a triple-click.

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:

Multithread safe.

Other Considerations:

None.

Member Function: TSelectTextInteractor::HandleSelectWord

virtual void HandleSelectWord (const TTextOffset &)

Interface Category:

API.

Purpose:

At the given text offset, set the selection to the bounds of the intersecting word.

Calling Context:

Called by Text Framework classes.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

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