home *** CD-ROM | disk | FTP | other *** search
- //========================================================================
- // The following example routines have been provided by the Technical
- // Support staff at Borland International. They are provided as a
- // courtesy and not as part of a Borland product, and as such, are
- // provided without the assurance of technical support or any specific
- // guarantees.
- //========================================================================
- //
- // funkview.h: The class definition for TMyApp.
- //
-
- //
- // class FunkyView
- // View that simply displays some text on the screen in a random color.
- //
- // Member functions:
- // FunkyView - Constructor
- // ~FunkyView - Destructor
- // draw - Display the text
- //
- // for stream support:
- // FunkyView - stream constructor
- // streamableName
- // build
- // read
- // write
- //
-
- class FunkyView : public TView
- {
-
- public:
-
- FunkyView( TRect& r, char *word );
- ~FunkyView() { delete text; }
- virtual void draw();
-
- private:
-
- char *text;
-
- // Stream support is from here on down.
-
- virtual const char *streamableName() const
- { return name; }
-
- protected:
-
- virtual void write( opstream& op );
- virtual void *read( ipstream& ip );
-
- public:
-
- FunkyView( StreamableInit ) : TView( streamableInit ) { }
- static TStreamable *build();
-
- static const char * const name;
-
- };
-
- inline ipstream& operator >> ( ipstream& is, FunkyView& cl )
- { return is >> (TStreamable&) cl; }
- inline ipstream& operator >> ( ipstream& is, FunkyView*& cl )
- { return is >> (void *&) cl; }
-
- inline opstream& operator << ( opstream& os, FunkyView& cl )
- { return os << (TStreamable&) cl; }
- inline opstream& operator << ( opstream& os, FunkyView* cl )
- { return os << (TStreamable *) cl; }
-
-
- //
- // classFunkyWindow -
- // provides encapsulation for FunkyView, as well as the ability to move
- // the view around the screen and remove it from the desktop with little
- // coding (since TWindow's automatically calls cmClose)
- //
- // Member functions:
- // FunkyWindow - Constructor
- // sizeLimits - so we can have a smaller than regulation TWindow.
- //
- // for stream support:
- // FunkyWindow - stream constructor
- // streamableName
- // build
- // read
- // write
- //
-
- #define FUNK_WIDTH 31
- #define FUNK_HEIGHT 7
-
-
- #pragma argsused
-
- class FunkyWindow : public TWindow
- {
-
- public:
-
- FunkyWindow( TRect& r, char *words);
-
- // Stream support is from here on down.
-
- virtual const char *streamableName() const
- { return name; }
-
- protected:
-
- // virtual void write( opstream& op ); // These will be inherited.
- // virtual void *read( ipstream& ip );
-
- public:
-
- FunkyWindow( StreamableInit ) : TWindow( streamableInit ),
- TWindowInit( streamableInit ) { }
- static TStreamable *build();
-
- static const char * const name;
-
- };
-
- inline ipstream& operator >> ( ipstream& is, FunkyWindow& cl )
- { return is >> (TStreamable&) cl; }
- inline ipstream& operator >> ( ipstream& is, FunkyWindow*& cl )
- { return is >> (void *&) cl; }
-
- inline opstream& operator << ( opstream& os, FunkyWindow& cl )
- { return os << (TStreamable&) cl; }
- inline opstream& operator << ( opstream& os, FunkyWindow* cl )
- { return os << (TStreamable *) cl; }
-