home *** CD-ROM | disk | FTP | other *** search
- // Program : TEXPLODE.H
- // Author : Eric Woodruff, CIS ID: 72134,1150
- // Updated : Wed 08/25/93 09:42:58
- // Note : Copyright 1993, Eric Woodruff, All rights reserved
- // Compiler: Borland C++ 3.1
- //
- // This header file defines a TWindow derived class and a TDialog derived
- // class that can explode on opening or showing and implode on closing
- // or hiding.
- //
- // If you use these classes in your own programs, please send $10 to:
- //
- // Eric Woodruff
- // 16719 Lakeside Drive
- // Medical Lake WA 99022
- //
- // Feel free to distribute these files to anyone, but please distribute them
- // in UNMODIFIED form. If you find any bugs or make any interesting changes,
- // please let me know so that I can maintain these classes and distribute
- // the updates.
- //
- // I can be reached on CompuServe at 72134,1150 if you have any
- // questions or comments. Thanks for trying these classes out!
- //
-
- #if !defined(__TEXPLODE_H)
- #define __TEXPLODE_H
-
- // Found in TGROUP.CPP and required by the changeBounds() functions.
- extern void doCalcChange(TView *p, void *d);
-
- // Direction types.
- enum Direction { expImploding = -1, expNeither, expExploding };
-
- #if defined(Uses_TExplodeWindow) && !defined(__TExplodeWindow)
- #define __TExplodeWindow
-
- class far TRect;
- class far TWindow;
-
- class TExplodeWindow : public TWindow
- {
- private:
- Boolean WillExplode, WillImplode; // Flags to signal the need
- Direction Is_Exploding_Imploding; // to explode or implode.
- short msDelay; // Milliseconds between draws.
-
- void Explode(void); // Explode the window upon opening/showing.
- void Implode(void); // Implode the window upon closing/hiding.
- void ExpImpDraw(void); // Specialized explode/implode draw.
-
- public:
- TExplodeWindow(const TRect &r, const char *aTitle, short aNumber) :
- TWindow(r, aTitle, aNumber), TWindowInit(&TExplodeWindow::initFrame)
- {
- // Default to exploding window.
- msDelay = 20; // Default to 20ms delay.
- WillExplode = True;
- WillImplode = False;
- Is_Exploding_Imploding = expNeither;
- }
-
- virtual void setState(ushort aState, Boolean enable);
- virtual void changeBounds(const TRect &bounds);
- virtual void sizeLimits(TPoint &min, TPoint &max);
- virtual void draw(void);
- virtual void close(void);
-
- // Turn it back into a normal window.
- inline void MakeItNormal(void)
- { WillExplode = WillImplode = False; }
-
- // Tell the window to explode on opening and implode on closing.
- // Also used to change the explode/implode delay.
- inline void MakeItExplode(short ms)
- { WillExplode = True; msDelay = ms; }
-
- // Get the current explode/implode delay factor.
- inline short GetDelay(void)
- { return msDelay; }
-
- // This stuff will make it streamable.
- private:
- virtual const char *streamableName() const
- { return name; }
-
- protected:
- TExplodeWindow(StreamableInit) : TWindow(streamableInit),
- TWindowInit(streamableInit) {}
-
- public:
- static const char * const near name;
- static TStreamable *build();
-
- protected:
- virtual void write(opstream &);
- virtual void *read(ipstream &);
- };
-
- inline ipstream& operator >> ( ipstream& is, TExplodeWindow& cl )
- { return is >> (TStreamable&)cl; }
- inline ipstream& operator >> ( ipstream& is, TExplodeWindow*& cl )
- { return is >> (void *&)cl; }
-
- inline opstream& operator << ( opstream& os, TExplodeWindow& cl )
- { return os << (TStreamable&)cl; }
- inline opstream& operator << ( opstream& os, TExplodeWindow* cl )
- { return os << (TStreamable *)cl; }
-
- #endif // TExplodeWindow
-
- #if defined(Uses_TExplodeDialog) && !defined(__TExplodeDialog)
- #define __TExplodeDialog
-
- class far TRect;
- class far TDialog;
- class far TWindow;
- class far TWindowInit;
-
- class TExplodeDialog : public TDialog
- {
- private:
- Boolean WillExplode, WillImplode; // Flags to signal the need
- Direction Is_Exploding_Imploding; // to explode or implode.
- short msDelay; // Milliseconds between draws.
-
- void Explode(void); // Explode the window upon opening/showing.
- void Implode(void); // Implode the window upon closing/hiding.
- void ExpImpDraw(void); // Specialized explode/implode draw.
-
- public:
- TExplodeDialog(const TRect &r, const char *aTitle) :
- TDialog(r, aTitle), TWindowInit(&TExplodeDialog::initFrame)
- {
- // Default to exploding dialog box.
- msDelay = 20; // Default to 20ms delay.
- WillExplode = True;
- WillImplode = False;
- Is_Exploding_Imploding = expNeither;
- }
-
- virtual void setState(ushort aState, Boolean enable);
- virtual void changeBounds(const TRect &bounds);
- virtual void sizeLimits(TPoint &min, TPoint &max);
- virtual void draw(void);
- virtual void close(void);
-
- // Turn it back into a normal window.
- inline void MakeItNormal(void)
- { WillExplode = WillImplode = False; }
-
- // Tell the window to explode on opening and implode on closing.
- // Also used to change the explode/implode delay.
- inline void MakeItExplode(short ms)
- { WillExplode = True; msDelay = ms; }
-
- // Get the current explode/implode delay factor.
- inline short GetDelay(void)
- { return msDelay; }
-
- // This stuff will make it streamable.
- private:
- virtual const char *streamableName() const
- { return name; }
-
- protected:
- TExplodeDialog(StreamableInit) : TDialog(streamableInit),
- TWindowInit(&TExplodeDialog::initFrame) {}
-
- public:
- static const char * const near name;
- static TStreamable *build();
-
- protected:
- virtual void write(opstream &);
- virtual void *read(ipstream &);
- };
-
- inline ipstream& operator >> ( ipstream& is, TExplodeDialog& cl )
- { return is >> (TStreamable&)cl; }
- inline ipstream& operator >> ( ipstream& is, TExplodeDialog*& cl )
- { return is >> (void *&)cl; }
-
- inline opstream& operator << ( opstream& os, TExplodeDialog& cl )
- { return os << (TStreamable&)cl; }
- inline opstream& operator << ( opstream& os, TExplodeDialog* cl )
- { return os << (TStreamable *)cl; }
-
- #endif // TExplodeDialog
-
- #endif // __TEXPLODE_H
-