#ifdef __GNUC__ #pragma interface #endif #include #include #include typedef Controller Karet; // for backward compat // a ChildWindow drags its parents and children along wherever it goes // and the destroy() method deletes childen when allocated // with ChildWin::operator new. // NOTE, if a ChildWin is allocated via ::operator new, then it must // be manually deleted. If allocated with ChildWin::operator new (the // default) or on the stack, it must *not* be deleted. class ChildWin: public virtual Controller,virtual public Window { ChildWin(const ChildWin &); ChildWin& operator=(const ChildWin &); friend class ChildWinList; ChildWin *cur, *child; // parent stuff int idx, cnt; ChildWin *parent, *next; // child stuff char destroy_flag; static char newflag; void link(ChildWin *p); public: void unlink(); void *operator new(size_t s) { newflag = 1; return new char[s]; } void operator delete(void *p) { delete [] (char *)p; } static void destroy(ChildWin *c); ChildWin(ChildWin *p = 0); ChildWin *getparent() const { return parent; } ChildWin *operator[](int); int count() const { return cnt; } void setparent(ChildWin *p) { unlink(); link(p); } void setphys(const Rect &r); void hide(); void top(); void bury(); ~ChildWin(); }; class ChildWinList { ChildWin &pwin; protected: int cur; public: ChildWinList(ChildWin &p): pwin(p) { cur = 0; } ChildWin *first() { return pwin[cur = 0]; } ChildWin *next() { return pwin[++cur]; } };