home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-03-26 | 4.5 KB | 76 lines | [TEXT/MMCC] |
- //------------------------------------------------------------------------------
- // File: window.h
- // Date: 7/17/94
- // Author: Bretton Wade
- //
- // Description: this file contains the class definition for a window. a
- // window is a user interface item that descends from a widget.
- // this implementation uses a macintosh DialogRecord, and
- // stores a pointer to the window widget in the refCon field
- // of the record. All windows are dialogs.
- //
- //------------------------------------------------------------------------------
-
- #include "tabstop.h"
-
- #ifndef WINDOW
- #define WINDOW
-
- //------------------------------------------------------------------------------
- // functions
- //------------------------------------------------------------------------------
- WindowPtr MyFrontWindow (void); // find the frontmost window belonging to the application
- bool CloseAllWindows (void); // attempt to close all of the windows
-
- //------------------------------------------------------------------------------
- // classes
- //------------------------------------------------------------------------------
- class window : public widget // user interface window class
- { // begin
- private: // members internal to this class only
- void PullRect (Point, Rect&, Rect&);
- void MyGrowWindow (Point pt);
- protected: // members internal to this class hierarchy
- DialogPtr dialog; // the system storage class for a dialog
- bool modeless; // whether or not this is a modeless window
- short tabstops; // number of tabstops in the window
- tabstop **stops; // array of tabstop pointers
- short curstop; // the current tabstop
- float aspect; // the aspect ratio constraint (x / y)
- public: // members available externally
- window (short, short, bool = TRUE); // constructor
- virtual ~window (void); // destructor
- virtual widget *AdjustCursor (EventRecord&); // adjust the cursor appropriately
- virtual void HandleClick (EventRecord&); // handle mouse down/up
- void HandleClickInContent (EventRecord&); // handle a click in the content region
- virtual void HandleKey (EventRecord&); // handle key press events
- virtual void Update (EventRecord&); // draw the widget and all of its children
- virtual void Activate (EventRecord&); // activate/deactivate the widget
- virtual void Resize (EventRecord&); // recompute sizing information from parent
- virtual void AddChild (widget*); // add a child widget to this one
- virtual bool Close (void); // close the window
- bool Modeless (void); // say if it is ok for this window to deactivate
- GrafPtr Port (void); // return the drawing port corresponding to the window
- void DrawGrowIcon (void); // draw the little tiddlywink in the lower right corner
- void SetTabStop (short, tabstop*); // set a tabstop
- void SetAspectRatio (short, short); // set the aspect ratio constraint value
- virtual void Draw (void); // draw the widget
- }; // end
-
- //------------------------------------------------------------------------------
- // inline class methods
- //------------------------------------------------------------------------------
- inline bool window::Modeless (void) // method to say if it is ok for this window to deactivate
- { // begin
- return modeless; // return the modeless value
- } // end
-
- //------------------------------------------------------------------------------
- inline GrafPtr window::Port (void) // return the drawing port corresponding to the window
- { // begin
- return dialog; // return the dialogptr value
- } // end
- //------------------------------------------------------------------------------
-
- #endif //WINDOW
-