home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / BSP Tree 1.2 / Sources / Core / include / window.h < prev   
Encoding:
Text File  |  1995-03-26  |  4.5 KB  |  76 lines  |  [TEXT/MMCC]

  1. //------------------------------------------------------------------------------
  2. //    File:                    window.h
  3. //    Date:                    7/17/94
  4. //    Author:                Bretton Wade
  5. //
  6. //    Description:    this file contains the class definition for a window. a
  7. //                                window is a user interface item that descends from a widget.
  8. //                                this implementation uses a macintosh DialogRecord, and
  9. //                                stores a pointer to the window widget in the refCon field
  10. //                                of the record. All windows are dialogs.
  11. //
  12. //------------------------------------------------------------------------------
  13.  
  14. #include "tabstop.h"
  15.  
  16. #ifndef    WINDOW
  17. #define    WINDOW
  18.  
  19. //------------------------------------------------------------------------------
  20. //    functions
  21. //------------------------------------------------------------------------------
  22. WindowPtr    MyFrontWindow (void);                                                                                                    //    find the frontmost window belonging to the application
  23. bool            CloseAllWindows (void);                                                                                                //    attempt to close all of the windows
  24.  
  25. //------------------------------------------------------------------------------
  26. //    classes
  27. //------------------------------------------------------------------------------
  28. class    window : public widget                                                                                                        //    user interface window class
  29. {                                                                                                                                                                //    begin
  30.     private:                                                                                                                                            //    members internal to this class only
  31.                 void        PullRect (Point, Rect&, Rect&);
  32.                 void        MyGrowWindow (Point pt);
  33.     protected:                                                                                                                                        //    members internal to this class hierarchy
  34.                 DialogPtr    dialog;                                                                                                                //    the system storage class for a dialog
  35.                 bool            modeless;                                                                                                            //    whether or not this is a modeless window
  36.                 short            tabstops;                                                                                                            //    number of tabstops in the window
  37.                 tabstop        **stops;                                                                                                            //    array of tabstop pointers
  38.                 short            curstop;                                                                                                            //    the current tabstop
  39.                 float            aspect;                                                                                                                //    the aspect ratio constraint (x / y)
  40.     public:                                                                                                                                                //    members available externally
  41.                 window (short, short, bool = TRUE);                                                                            //    constructor
  42. virtual    ~window (void);                                                                                                                    //    destructor
  43. virtual    widget    *AdjustCursor (EventRecord&);                                                                        //    adjust the cursor appropriately
  44. virtual    void        HandleClick (EventRecord&);                                                                            //    handle mouse down/up
  45.                 void        HandleClickInContent (EventRecord&);                                                        //    handle a click in the content region
  46. virtual    void        HandleKey (EventRecord&);                                                                                //    handle key press events
  47. virtual    void        Update (EventRecord&);                                                                                    //    draw the widget and all of its children
  48. virtual    void        Activate (EventRecord&);                                                                                //    activate/deactivate the widget
  49. virtual    void        Resize (EventRecord&);                                                                                    //    recompute sizing information from parent
  50. virtual    void        AddChild (widget*);                                                                                            //    add a child widget to this one
  51. virtual    bool        Close (void);                                                                                                        //    close the window
  52.                 bool        Modeless (void);                                                                                                //    say if it is ok for this window to deactivate
  53.                 GrafPtr    Port (void);                                                                                                        //    return the drawing port corresponding to the window
  54.                 void        DrawGrowIcon (void);                                                                                        //    draw the little tiddlywink in the lower right corner
  55.                 void        SetTabStop (short, tabstop*);                                                                        //    set a tabstop
  56.                 void        SetAspectRatio (short, short);                                                                    //    set the aspect ratio constraint value
  57. virtual    void        Draw (void);                                                                                                        //    draw the widget
  58. };                                                                                                                                                            //    end
  59.  
  60. //------------------------------------------------------------------------------
  61. //    inline class methods
  62. //------------------------------------------------------------------------------
  63. inline    bool        window::Modeless (void)                                                                                    //    method to say if it is ok for this window to deactivate
  64. {                                                                                                                                                                //    begin
  65.     return modeless;                                                                                                                            //    return the modeless value
  66. }                                                                                                                                                                //    end
  67.  
  68. //------------------------------------------------------------------------------
  69. inline    GrafPtr    window::Port (void)                                                                                            //    return the drawing port corresponding to the window
  70. {                                                                                                                                                                //    begin
  71.     return dialog;                                                                                                                                //    return the dialogptr value
  72. }                                                                                                                                                                //    end
  73. //------------------------------------------------------------------------------
  74.  
  75. #endif    //WINDOW
  76.