home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-07-13 | 2.2 KB | 88 lines | [TEXT/CWIE] |
- //Copyright (c) 1997 Aidan Cully
- //All rights reserved
-
- #ifndef _WINDOWTYPES_H
- #define _WINDOWTYPES_H
-
- #include <windows.h>
- #include "CLList.h"
- #include "CLDrawSlate.h"
- #include "CLMouseListener.h"
-
- enum {
- kWindowSuccess = 0,
- kWindowNotInitializedErr = 1,
- kWindowInvalidPartCodeErr = 2,
- kWindowMemErr = 3
- };
-
- #define wkBaseWindow 0
-
- #define kwKillMe -1
- #define kKillMainWindow 'KRwt'
-
- class TLayoutLeaf;
- class TWindowDrawer;
- class TWindowLayer;
-
- class TBaseWindow:
- public TDrawSlate,
- public MMouseListener
- {
- private:
- SInt16 mhWinRes;
- GrafPtr mhOldPort;
- protected:
- WindowRef mWindow;
- Boolean mOpen, mActive;
- TLayoutLeaf *mContent;
- TList<TWindowDrawer*> mNeedWindowDrawers;
- TWindowLayer *mLayer;
- virtual void DoContentClick( const TMouseButtonEvent* );
- virtual void DoGrow( const TMouseButtonEvent* );
- virtual void DoDrag( const TMouseButtonEvent* );
- virtual void DoZoom( short partCode, const TMouseButtonEvent* );
- virtual SInt8 RespondResizeSelf( const Rect &oldRect, const Rect &newRect );
- virtual Boolean GetDrawSelf();
- virtual Boolean ReleaseDrawSelf();
- virtual void DrawSelf();
- public:
- TBaseWindow( SInt16, TWindowLayer*, TLayoutLeaf* );
- Boolean IsOpen();
- WindowRef GetWindow();
- virtual ~TBaseWindow();
- virtual void HandleMouse( TMouseButtonEvent* );
- virtual void DoMouseDown( short, const TMouseButtonEvent* );
- virtual SInt8 DoUpdate();
- virtual SInt8 MakeActive( Boolean );
- virtual SInt8 DoHideWindow();
- virtual SInt8 DoShowWindow();
- virtual SInt8 SetWTitle( const Str255 );
- virtual SInt8 GetWTitle( Str255 );
- virtual SInt8 DoClose();
- virtual SInt8 Init();
- virtual void Draw();
- virtual void LocalToGlobal( Point* );
- virtual void GlobalToLocal( Point* );
- virtual void SelectWindow();
- virtual void ClipAbove( RgnHandle );
- virtual void CalcMouseMove( const Point&, RgnHandle );
- virtual void HandleMouseMoved( TMouseEvent*, bool );
- virtual Boolean IsActive() {return( mActive );};
- virtual void AddDrawer( TWindowDrawer* );
- };
-
- extern void GetGrowRgn( const Rect &, RgnHandle );
- extern void GetWindowDiffRect( WindowRef, Rect * );
-
- inline Boolean TBaseWindow::IsOpen()
- {
- return( mOpen );
- }
-
- inline WindowRef TBaseWindow::GetWindow()
- {
- return( mWindow );
- }
-
- #endif