home *** CD-ROM | disk | FTP | other *** search
- /* ------------------------------------------------------------------------*/
- /* */
- /* TFIELD.H */
- /* */
- /* Portions Copyright (c) Borland International 1991 */
- /* All Rights Reserved. */
- /* */
- /* defines the classes TField */
- /* */
- /* ------------------------------------------------------------------------*/
-
-
- /* ---------------------------------------------------------------------- */
- /* class TField */
- /* */
- /* Palette layout */
- /* 1 = Passive */
- /* 2 = Active */
- /* 3 = Selected */
- /* 4 = Arrows */
- /* ---------------------------------------------------------------------- */
-
- #if defined( Uses_TField ) && !defined( __TField )
- #define __TField
-
- //
- // 1/17/92 -- MBB
- // Added the following justification control constants
- //
- const int jLeft = 1; // left justification
- const int jRight = 2; // right justification
-
-
- class far TRect;
- class far TEvent;
-
- class TField : public TView
- {
-
- public:
-
- TField( const TRect& bounds, int aMaxLen );
- ~TField();
-
- virtual ushort dataSize();
- virtual void draw();
- virtual void getData( void *rec );
- virtual TPalette& getPalette() const;
- virtual void handleEvent( TEvent& event );
- void selectAll( Boolean enable );
- virtual void setData( void *rec );
- virtual void setState( ushort aState, Boolean enable );
- virtual void setScroll( Boolean enable );
- virtual void setJustification( int jValue );
-
-
- char* data;
- int maxLen;
- int curPos;
- int firstPos;
- int selStart;
- int selEnd;
- //
- // 1/16/92 -- MBB
- // Extension to TInputLine's data structure to allow user to turn
- // scrolling off. scrollState should be set to zero to disable scrolling
- // or to any non-zero value to enable scrolling.
- //
- int scrollState;
- //
- // 1/17/92 -- MBB
- // added justification to control whether the field fills from the
- // right (jRight) or from the default left (jLeft)
- //
- int justification;
-
- private:
-
- Boolean canScroll( int delta );
- int mouseDelta( TEvent& event );
- int mousePos( TEvent& event );
- void deleteSelect();
-
- static const char near rightArrow;
- static const char near leftArrow;
-
- virtual const char *streamableName() const
- { return name; }
-
- protected:
-
- TField( StreamableInit );
- virtual void write( opstream& );
- virtual void *read( ipstream& );
-
- public:
-
- static const char * const near name;
- static TStreamable *build();
-
- };
-
- inline ipstream& operator >> ( ipstream& is, TField& cl )
- { return is >> (TStreamable&)cl; }
- inline ipstream& operator >> ( ipstream& is, TField*& cl )
- { return is >> (void *&)cl; }
-
- inline opstream& operator << ( opstream& os, TField& cl )
- { return os << (TStreamable&)cl; }
- inline opstream& operator << ( opstream& os, TField* cl )
- { return os << (TStreamable *)cl; }
-
- #endif // Uses_TField
-
-