home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / Framewrk / FWWindow / Include / FWWindow.h < prev    next >
Encoding:
Text File  |  1996-08-16  |  6.6 KB  |  241 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWWindow.h
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9. //    FW_CWindow: Wrapper for a ODWindow.
  10. //    
  11. //        Every FW_CFrame object has a FW_CWindow object associated with it. When 
  12. //        FW_CFrame::FacetAdded (not FrameAdded) is called, a new FW_CWindow object is created 
  13. //        if the frame doesn't already have one. The FW_CWindow is automatically deleted when
  14. //        FW_CFrame::FrameRemoved is called.
  15. //
  16. //        You should never directly create a FW_CWindow, ODF will create it for you.
  17. //
  18. #ifndef FWWINDOW_H
  19. #define FWWINDOW_H
  20.  
  21. #ifndef SLWINDOW_H
  22. #include "SLWindow.h"
  23. #endif
  24.  
  25. // ----- OS Includes -----
  26.  
  27. #ifndef FWRECT_H
  28. #include "FWRect.h"
  29. #endif
  30.  
  31. #ifndef SLGDEV_H
  32. #include "SLGDev.h"
  33. #endif
  34.  
  35. // ----- Foundation Layer -----
  36.  
  37. #ifndef FWEXCLIB_H
  38. #include "FWExcLib.h"
  39. #endif
  40.  
  41. #ifndef FWRUNTYP_H
  42. #include "FWRunTyp.h"
  43. #endif
  44.  
  45. // ----- OpenDoc Includes -----
  46.  
  47. #ifndef FWODTYPS_H
  48. #include "FWODTyps.h"
  49. #endif
  50.  
  51. #ifndef SOM_ODWindow_xh
  52. #include <Window.xh>
  53. #endif
  54.  
  55. //========================================================================================
  56. //    Forward Declarations
  57. //========================================================================================
  58.  
  59. class FW_CPart;
  60. class FW_CPresentation;
  61. class ODFrame;
  62. class FW_CString;
  63. struct WindowProperties;
  64. class ODSession;
  65.  
  66. //========================================================================================
  67. //    class FW_CWindow
  68. //========================================================================================
  69.  
  70. class FW_CWindow
  71. {
  72. public:
  73.     FW_DECLARE_CLASS
  74.     
  75. //----------------------------------------------------------------------------------------
  76. //    Constructors/Destructor
  77. //
  78. public:
  79.     
  80.     FW_CWindow(Environment* ev, 
  81.                 FW_CPart* thePart,
  82.                 ODTypeToken viewType,
  83.                 FW_CPresentation* presentation,
  84.                 const FW_CPoint& interiorSize,        // in pixels
  85.                 const FW_CPoint& position,            // in pixels
  86.                 FW_WindowStyle style);
  87.         // for document window
  88.                 
  89.     FW_CWindow(Environment* ev, 
  90.                 FW_CPart* thePart,
  91.                 ODFrame* parentFrame,
  92.                 FW_Boolean persistent,
  93.                 ODTypeToken viewType,
  94.                 FW_CPresentation* presentation,
  95.                 const FW_CString& defaultTitle,
  96.                 const FW_CPoint& interiorSize,        // in pixels
  97.                 const FW_CPoint& position,            // in pixels
  98.                 FW_WindowStyle style);
  99.         // for View As Window
  100.                 
  101.     FW_CWindow(Environment* ev, 
  102.                 FW_CPart* thePart,
  103.                 ODFrame* odFrame);
  104.         // Creates a window from a frame
  105.                 
  106.     FW_CWindow(Environment* ev, 
  107.                 FW_CPart* thePart, 
  108.                 ODID windowID);
  109.         // Create a window for non-root frame
  110.                 
  111.     virtual ~FW_CWindow();
  112.         
  113. //----------------------------------------------------------------------------------------
  114. //    From ODWindow (inlines)
  115. //
  116. public:
  117.     FW_Boolean                    IsActive(Environment *ev) const;
  118.     ODPlatformWindow            GetPlatformWindow(Environment *ev) const;
  119.  
  120.     virtual void                Select(Environment *ev) const;
  121.  
  122.     virtual FW_Boolean            IsFloating(Environment* ev) const;
  123.  
  124.     virtual void                Close(Environment *ev);
  125.     virtual void                CloseAndRemove(Environment *ev);
  126.  
  127.  
  128.     virtual void                Show(Environment* ev);
  129.     virtual void                 Hide(Environment* ev);
  130.     FW_Boolean                     IsShown(Environment* ev) const;
  131.  
  132. //----------------------------------------------------------------------------------------
  133. //    New API
  134. //
  135. public:
  136.     virtual ODID                GetID(Environment *ev) const;
  137.     virtual void                SetID(Environment *ev, ODID windowID);
  138.  
  139.     virtual ODWindow*            AcquireODWindow(Environment *ev) const;
  140.     
  141.     // ----- Show/Hide -----
  142.     void                        ShowHide(Environment* ev, 
  143.                                     FW_Boolean state);
  144.     
  145.     // ----- Graphic Device -----
  146.     FW_HGDevice                    GetGraphicDevice(Environment* ev) const;
  147.     
  148.     // ----- Window Title -----
  149.     void                        GetWindowTitle(Environment* ev, 
  150.                                     FW_CString& windowTitle) const;
  151.     void                        SetWindowTitle(Environment* ev, 
  152.                                     const FW_CString& windowTitle);
  153.     
  154.     // ----- Window Geometry -----
  155.     void                        SetWindowSize(Environment* ev, 
  156.                                     const FW_CPoint& interiorSize);
  157.     void                        SetWindowPosition(Environment* ev,
  158.                                     const FW_CPoint& newPosition);
  159.     
  160.     void                        GetWindowSize(Environment* ev, 
  161.                                     FW_CPoint& interiorSize) const;
  162.     void                        GetWindowPosition(Environment* ev, 
  163.                                     FW_CPoint& position) const;
  164.                                     
  165.     void                        GetBorderSize(Environment* ev,
  166.                                     FW_CRect& borderSize) const;
  167.     
  168.     void                        FitToScreen(Environment* ev);
  169.     
  170.     // ----- Coordinate Conversion -----
  171.     void                        WindowToScreen(Environment* ev,
  172.                                     FW_CPoint* points, 
  173.                                     unsigned short nbPoint = 1);
  174.     void                        ScreenToWindow(Environment* ev,
  175.                                     FW_CPoint* points, 
  176.                                     unsigned short nbPoint = 1);
  177.  
  178.     void                        WindowToScreen(Environment* ev,
  179.                                     FW_CRect& rect)
  180.                                     {WindowToScreen(ev, (FW_CPoint*)&rect, 2);}
  181.     void                        ScreenToWindow(Environment* ev,
  182.                                     FW_CRect& rect)
  183.                                     {ScreenToWindow(ev, (FW_CPoint*)&rect, 2);}
  184.                                     
  185. //----------------------------------------------------------------------------------------
  186. //    Internal Only
  187. //
  188. public:
  189. #ifdef FW_BUILD_MAC    
  190.     // ----- Mac Window Zooming -----
  191.     void                        PrivMacDoZoom(Environment* ev, 
  192.                                     const FW_CPoint& zoomedSize, 
  193.                                     const FW_CRect& borderSize,
  194.                                     const FW_CRect& screenRect,
  195.                                     unsigned long message);
  196. #endif
  197.  
  198.     // ----- ODWindow creation -----
  199.     void                        PrivOpenWindow(Environment* ev,
  200.                                     ODWindow* odWindow);
  201.  
  202.     ODWindow*                    PrivCreateODWindow(Environment* ev, 
  203.                                     FW_CPart* thePart,
  204.                                     ODFrame* parentFrame,
  205.                                     FW_Boolean persistent,
  206.                                     ODTypeToken viewType,
  207.                                     FW_CPresentation* presentation,
  208.                                     const FW_CString& windowTitle,
  209.                                     const FW_CPoint& interiorSize,
  210.                                     const FW_CPoint& position,
  211.                                     FW_WindowStyle style);
  212.  
  213.     void                        PrivCreateODWindowForFrame(Environment* ev, 
  214.                                     FW_CPart* thePart,
  215.                                     ODFrame* odFrame);
  216.     
  217. //----------------------------------------------------------------------------------------
  218. //    Data Members
  219. //
  220. protected:
  221.     ODID                        fWindowID;
  222.     ODSession*                    fSession;
  223.     
  224. private:
  225.     FW_HGDevice                    fGraphicDevice;
  226. };
  227.  
  228. //========================================================================================
  229. //    Inlines
  230. //========================================================================================
  231.  
  232. //----------------------------------------------------------------------------------------
  233. // FW_CWindow::ShowHide
  234. //----------------------------------------------------------------------------------------
  235. inline void FW_CWindow::ShowHide(Environment* ev, FW_Boolean state)
  236. {
  237.     state ? Show(ev) : Hide(ev);
  238. }
  239.  
  240. #endif
  241.