home *** CD-ROM | disk | FTP | other *** search
- /*****************************************************************************
- CSmartEditText: subclass of CEditText that adds some additional features.
- These are:
-
- • In conjunction with CSmartDocument, supports tabbing through
- edit text items as in dialogs and forms.
-
- • Keeps track of "dirty" state. Any changes to the text set the dirty
- flag. This can be read by calling IsDirty() or cleared by calling
- ClearDirty().
-
- • Can be toggled as edit or static text by calling SetEditable.
-
- • Support for default buttons or other items via the passReturns
- flag. If this is set then CR and Enter keydowns are passed
- up the chain of command. If the owning document is a CSmartDocument,
- then these keydowns can be passed to some default object like a button.
-
- • Some other miscellaneous utilities.
-
- • Supports undo via SmartTETask.
-
- by Dan Podwall - you may do anything you please with this code except
- charge for it, with the exception of normal network download charges.
-
- *****************************************************************************/
-
- #define _H_CSmartEditText
-
- #include "CEditText.h"
- #include "defs.h"
-
- typedef enum tTE_Command
- {
- teCut,
- teCopy,
- tePaste,
- teClear,
- teType
-
- } tTE_Command;
-
-
- struct CSmartEditText : CEditText
- {
- /* instance variables */
-
- struct CSmartDocument *itsSmartDoc;
- Boolean isKeyTarget;
- Boolean dirty;
- Boolean editable;
- Boolean passReturns;
- struct CSmartTETask *itsCurrentTask;
- Int16 firstTaskIndex;
- Point lastSelect;
-
- /* public methods */
-
- virtual void ISmartEditText(CView *anEnclosure, CBureaucrat *aSupervisor,
- Int16 aWidth, Int16 aHeight,
- Int16 aHEncl, Int16 aVEncl,
- SizingOption aHSizing, SizingOption aVSizing,
- Int16 aLineWidth, Int16 firstTaskIndex);
-
- virtual void DoCommand(Int32 theCommand);
-
- virtual void DoClick(Point hitPt, Int16 modifierKeys, Int32 when);
- virtual void DoKeyDown(char theChar, Byte keyCode, EventRecord *macEvent);
- virtual void SetTarget( Int16 isTarget);
-
- virtual void SetEditable( Int16 canEdit);
- virtual Boolean IsEditable( void);
-
- virtual void GetSelection( Int16 *startSel, Int16 *endSel);
- virtual void SetSelection( Int16 startSel, Int16 endSel);
- virtual void SelectAll( void);
-
- virtual void SetPassReturns( Int16 passFlag);
- virtual Boolean GetPassReturns( void);
-
- virtual void GetString( StringPtr string);
-
- virtual void Hide( void);
- virtual void ClearText( void);
- virtual Boolean IsDirty( void);
- virtual void SetDirty( Boolean dirty);
- virtual Int16 GetLineCount( void);
- virtual char GetLastChar( void);
-
- virtual void MakeTETask( tTE_Command theCommand);
- };