LTextEditView is a PowerPlant class that is used for wrapping the TextEdit functionality of the Mac OS Toolbox.
Methods :
The methods in this class are:
Data Members:
The data members in this class are:
Operation:
LTextEditView allows you to specify the font, style, size, color, and justificiation of the text you create.
Source files:
Ancestors:
Purpose:
The constructor creates objects from the passed-in parameters.
Access:
Prototype:
LTextEditView();
LTextEditView( const SPaneInfo& inPaneInfo,
const SViewInfo& inViewInfo,
UInt16 inTextAttributes,
ResIDT inTextTraitsID );
LTextEditView( LStream *inStream );Parameters:
The parameters for these constructors are:
Purpose:
The destructor destroys the object.
Access:
Prototype:
virtual ~LTextEditView();
Purpose:
TextEdit uses the standard I-Beam cursor. This is an override of AdjustCursorSelf() in LPane.
Purpose:
This method resizes the image to match the size of the text.
Access:
Prototype:
virtual void AdjustImageToText();Parameters:
Return:
Purpose:
Align the view and destination rectangles of the Toolbox TextEdit record with the Frame of a TextEdit.
Access:
Prototype:
virtual void AlignTextEditRects();Parameters:
Return:
Purpose:
TextEdit is becoming the Target.
Access:
Prototype:
virtual void BeTarget();Parameters:
Return:
Purpose:
Calculates the height of the TextEdit record.
Access:
Prototype:
SInt32 LTextEditView::CalcTEHeight()Parameters:
Return:
Height of TextEdit record as 32-bit value.
Purpose:
Changes the font size for a given selection range by a specified value.
Access:
Prototype:
Boolean LTextEditView::ChangeFontSizeBy( SInt16 inDeltaSize )Parameters:
Return:
Returns True if change was successful.
Remarks:
Will only work if the font over the selection range is constant.
Purpose:
Respond to Click inside a TextEdit. This is an override of ClickSelf() in LPane.
Purpose:
Used in the click loop to perform scrolling while clicking.
Access:
Prototype:
void LTextEdit::ClickAutoScroll( const Point &inLocalPoint )Parameters:
Return:
Purpose:
TextEdit is no longer the Target. Remove TextEdit from the IdleQueue. This is an override of DontBeTarget() in LCommander.
Purpose:
Draw a TextEdit. This is an override of DrawSelf() in LPane.
Purpose:
This method passes back the status of a command. This is an override of FindCommandStatus() in LCommander.
Purpose:
Prepare for drawing in the TextEdit. This is an override of FocusDraw() in LPane.
Purpose:
Works with TextEdit's autoscrolling capabilities to keep text and scrollbars syncronized.
Purpose:
Returns the justification setting for the TextEdit record.
Purpose:
Returns the raw attribute flags.
Access:
Remarks:
Purpose:
Returns the RGB value of the selected text.
Access:
Purpose:
Returns up to the first 255 characters of the TextEditView as a Pascal string.
Access:
Prototype:
StringPtr LTextEditView::GetDescriptor(
Str255 outDescriptor ) const Caller must allocate memory for the Str255 variable for storing the string.
Purpose:
Determine the font for the selection range. There are two versions of this routine. One passes back the font name, the other passes back the font number.
Access:
Prototype:
Boolean LTextEditView::GetFont(
SInt16 &outFontNum ) Boolean LTextEditView::GetFont(Str255 &outName )
Purpose:
Retrieve theHandle to the Mac TextEdit Record associated with a TextEdit.
Caller may change record fields, and is responsible for redrawing the TextEdit as necessary to reflect any changes. However, caller must not dispose of the TEHandle.
Access:
Prototype:
TEHandle GetMacTEH();Parameters:
Return:
Handle to the Mac TextEdit Record associated with a TextEdit.
Purpose:
Passes back the AppleEvent Descriptor of the seletected text.
Purpose:
Returns the size of the style record for the text range.
Purpose:
Returns the style of the selected text range.
Purpose:
Retrieve a Handle to the text in the LTextEditView. The Handle is the actual Handle used by the Toolbox TextEdit record. Treat this Handle as read-only.
Access:
Prototype:
virtual Handle GetTextHandle();Parameters:
Return:
Return a Handle to the text in the LTextEditView.
Purpose:
Returns the ID of the current TextTraits record.
Access:
Purpose:
Return an integer value represented by the contents of the TextEditView.
Access:
Prototype:
SInt32 LTextEditView::GetValue() constParameters:
Return:
Remarks:
An empty or non-numerical TextEditView evaluates to zero.
Purpose:
Handle key stroke directed at an TextEdit. This is an override of HandleKeyPress() in LCommander.
Purpose:
Check for the presence of a specific attribute.
Access:
Prototype:
Boolean HasAttribute( UInt16 inAttribute );Parameters:
The parameter for this method is:
Return:
Boolean indicating whether the attribute is present, false if not.
Purpose:
Hide an LTextEditView. An invisible LTextEditView can't be OnDuty. This is an override of HideSelf() in LPane.
Purpose:
Initialize member variables of a TextEdit to default values.
Access:
Prototype:
void InitTextEditView( ResIDT inTextTraitsID );Parameters:
The parameter for this method is:
Return:
Purpose:
Replacement for TEInsert() that allows for when text is greater than 32K. Call this routine
in place of TEInsert() or TEStyleInsert(). Will optionally recalculate, autoscroll, and refresh the text
if desired.
Access:
Purpose:
Move the location of the Frame by the specified amounts inHorizDelta and inVertDelta specify, in pixels, how far to move the Frame (within its surrounding
Image). Positive horizontal deltas move to the right, negative
to the left. Positive vertical deltas move down, negative up.
This is an override of MoveBy() in LPane.
Purpose:
ClickLoop callback used to help autoscrolling while selecting text.
Access:
Purpose:
Handle a click in a TextEdit field. Identical to the standard TEClick funtion, but includes code to handle a problem with clickloop functions in naitive mode.
Access:
Purpose:
Issue a command to a Commander. This is an override of ObeyCommand() in LCommander.
Purpose:
Change the Frame size by the specified amounts inWidthDelta and inHeightDelta specify, in pixels, how much larger to make the Frame. Positive
deltas increase the size, negative deltas reduce the size. This
is an override of ResizeFrameBy() in LPane.
Purpose:
Restore TextEdit parameters from a stream.
Access:
Prototype:
virtual void RestorePlace( LStream *inPlace );Parameters:
The parameter for this method is:
Return:
Purpose:
Save TextEdit parameters to a stream.
Access:
Prototype:
virtual void SavePlace( LStream *outPlace );Parameters:
The parameter for this method is:
Return:
Purpose:
Preserve the state so that an Undo operation is possible.
Access:
Prototype:
virtual STextEditUndoH SaveStateForUndo();Parameters:
Return:
Returns a handle to the Undo information.
Purpose:
Scroll the Text. This is an override of ScrollImageBy() in LView.
Purpose:
Select entire contents of an TextEdit.
Access:
Prototype:
virtual void SelectAll();Parameters:
Return:
Purpose:
Changes the justification of the TextEdit record.
Access:
Purpose:
Allows the setting of attributes. Replaced all existing attributes with the value passed as the argument.
Access:
Remarks:
If you want to change only a single attribute,use ToggleAttribute() instead.
Purpose:
Allows you to specify your own clickloop funtion.
Access:
Prototype:
void LTextEditView::SetClickLoop(
void *inClickLoop ) Return:
Remarks:
Disposes of existing clickloop, if any. Also since the point of the clickloop is for autoscrolling, that attribute is set here.
Purpose:
Sets the color of the text range
Access:
Purpose:
Sets the text to a given string
Access:
Remarks:
Replaces any and all text already in the descriptor.
Purpose:
Given a font name or font number, set the font of the selected text accordingly.
Access:
Prototype:
void LTextEditView::SetFont( SInt16 inFontNumber )
void LTextEditView::SetFont(
ConstStringPtr inFontName ) Purpose:
Sets the font size of the text range.
Access:
Purpose:
Sets the text style of the selected text.
Access:
Purpose:
Set the text in the LTextEditView to the contents of the specified Handle. The LTextEditView copies the data in the Handle, so the caller retains ownership of the Handle (and should dispose of it as needed).
Access:
Prototype:
virtual void SetTextHandle( Handle inTextH );Parameters:
The parameter for this method is:
Return:
Purpose:
Access:
Prototype:
virtual void SetTextPtr( Ptr inTextP,Parameters:
SInt32 inTextLen);
The parameters for this method are:
Return:
Purpose:
Specify the resource ID of the TextTraits for an TextEdit. This method updates the line height to fit the text characteristics.
Access:
Prototype:
virtual void SetTextTraitsID(Parameters:
ResIDT inTextTraitsID );
The parameter for this method is:
Return:
Purpose:
Flash the insertion cursor during idle time. This is an override of SpendTime() in LPeriodical.
Purpose:
Allows the toggling of an attribute setting.
Access:
Remarks:
If you want to change all attributes, use SetAttributes() instead.
Purpose:
Text of TextEdit has changed as a result of user action.
You should override this to validate the field and/or dynamically
update as the user types. This function is not called by SetDescriptor(), which is typically used to programatically change the text.
Access:
Prototype:
virtual void UserChangedText();Parameters:
Return:
Purpose:
Storage for the handle to the TextEdit record.
Access:
Prototype:
TEHandle mTextEditH;
Purpose:
Access:
Prototype:
ResIDT mTextTraitsID;
Purpose:
Storage for the text attributes.
Access:
Prototype:
UInt16 mTextAttributes;