home *** CD-ROM | disk | FTP | other *** search
- /*
- TSTRINP.HPP
-
- (C) Copyright 1992 Michael Joseph Newton
- All rights reserved.
-
- Header file for TStringInputLine class.
-
- The TStringInputLine class is derived from Turbo Vision's
- TInputLine class. TStringInputLine is declared in TSTRINP.HPP,
- and defined in TSTRINP.CPP.
-
- This file is hereby released by the author to the public
- domain. Use it as you will.
-
- Author: Michael Joseph Newton
- Date: 01/17/92
- Address: 17874 Marygold Ave. #32
- Bloomington, CA 92316
- Phone: (714) 877-4655
- CompuServe: 70402,531 (as Michael J. Newton)
- RelayNet: ->ECTECH (as Mick Newton)
-
- All questions or comments will be greatly appreciated!
- */
-
- #if !defined __TSTRINP_HPP
- #define __TSTRINP_HPP
-
- #define Uses_TInputLine
- #define Uses_TStreamable
-
- #include <tv.h>
-
- /*
- Define bits 10, 11, and 12 for TView::options word
- Define 'caseField' as 0xC00 (ofUpperCase | ofLowerCase)
- */
-
- const ushort ofMandInput = 0x400;
- const ushort ofUpperCase = 0x800;
- const ushort ofLowerCase = 0x1000;
- const ushort caseField = (ofUpperCase | ofLowerCase);
-
- /*
- If 'ofMandInput' bit is set, will not accept an empty string.
- If 'ofUpperCase' bit is set, will convert input to uppercase.
- If 'ofLowerCase' bit is set, will convert input to lowercase.
-
- Use "setf(ofMandInput)" to set the ofMandInput bit.
-
- Use "setf(ofUpperCase, caseField)" to clear the ofLowerCase bit and
- set the ofUpperCase bit.
-
- Use "setf(ofLowerCase, caseField)" to clear the ofUpperCase bit and
- set the ofLowerCase bit.
- */
-
-
- class TStringInputLine : public TInputLine
- {
- public:
- TStringInputLine(const TRect&, int aMaxLen);
- ~TStringInputLine();
- virtual ushort dataSize();
- virtual void getData(void *rec);
- virtual void setData(void *rec);
- virtual Boolean valid(ushort command);
- virtual void handleEvent(TEvent& event);
- ushort setf(ushort setBits, ushort aField);
- ushort setf(ushort setBits);
- protected:
- TStringInputLine(StreamableInit) :
- TInputLine(streamableInit){};
- virtual void write(opstream& os);
- virtual void *read(ipstream& is);
- private:
- virtual const char *streamableName() const
- {
- return name;
- };
- public:
- static const char * const name;
- static TStreamable *build();
- };
-
-
- inline ipstream& operator >> (ipstream& is, TStringInputLine& cl)
- {
- return is >> (TStreamable&) cl;
- };
-
- inline ipstream& operator >> (ipstream& is, TStringInputLine*& cl)
- {
- return is >> (void *&) cl;
- };
-
- inline opstream& operator << (opstream& os, TStringInputLine& cl)
- {
- return os << (TStreamable&) cl;
- };
-
- inline opstream& operator << (opstream& os, TStringInputLine* cl)
- {
- return os << (TStreamable *) cl;
- };
-
-
- #endif // End of __TSTRINP_HPP
-
-