home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-08-16 | 6.6 KB | 241 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWWindow.h
- // Release Version: $ ODF 1 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
- // FW_CWindow: Wrapper for a ODWindow.
- //
- // Every FW_CFrame object has a FW_CWindow object associated with it. When
- // FW_CFrame::FacetAdded (not FrameAdded) is called, a new FW_CWindow object is created
- // if the frame doesn't already have one. The FW_CWindow is automatically deleted when
- // FW_CFrame::FrameRemoved is called.
- //
- // You should never directly create a FW_CWindow, ODF will create it for you.
- //
- #ifndef FWWINDOW_H
- #define FWWINDOW_H
-
- #ifndef SLWINDOW_H
- #include "SLWindow.h"
- #endif
-
- // ----- OS Includes -----
-
- #ifndef FWRECT_H
- #include "FWRect.h"
- #endif
-
- #ifndef SLGDEV_H
- #include "SLGDev.h"
- #endif
-
- // ----- Foundation Layer -----
-
- #ifndef FWEXCLIB_H
- #include "FWExcLib.h"
- #endif
-
- #ifndef FWRUNTYP_H
- #include "FWRunTyp.h"
- #endif
-
- // ----- OpenDoc Includes -----
-
- #ifndef FWODTYPS_H
- #include "FWODTyps.h"
- #endif
-
- #ifndef SOM_ODWindow_xh
- #include <Window.xh>
- #endif
-
- //========================================================================================
- // Forward Declarations
- //========================================================================================
-
- class FW_CPart;
- class FW_CPresentation;
- class ODFrame;
- class FW_CString;
- struct WindowProperties;
- class ODSession;
-
- //========================================================================================
- // class FW_CWindow
- //========================================================================================
-
- class FW_CWindow
- {
- public:
- FW_DECLARE_CLASS
-
- //----------------------------------------------------------------------------------------
- // Constructors/Destructor
- //
- public:
-
- FW_CWindow(Environment* ev,
- FW_CPart* thePart,
- ODTypeToken viewType,
- FW_CPresentation* presentation,
- const FW_CPoint& interiorSize, // in pixels
- const FW_CPoint& position, // in pixels
- FW_WindowStyle style);
- // for document window
-
- FW_CWindow(Environment* ev,
- FW_CPart* thePart,
- ODFrame* parentFrame,
- FW_Boolean persistent,
- ODTypeToken viewType,
- FW_CPresentation* presentation,
- const FW_CString& defaultTitle,
- const FW_CPoint& interiorSize, // in pixels
- const FW_CPoint& position, // in pixels
- FW_WindowStyle style);
- // for View As Window
-
- FW_CWindow(Environment* ev,
- FW_CPart* thePart,
- ODFrame* odFrame);
- // Creates a window from a frame
-
- FW_CWindow(Environment* ev,
- FW_CPart* thePart,
- ODID windowID);
- // Create a window for non-root frame
-
- virtual ~FW_CWindow();
-
- //----------------------------------------------------------------------------------------
- // From ODWindow (inlines)
- //
- public:
- FW_Boolean IsActive(Environment *ev) const;
- ODPlatformWindow GetPlatformWindow(Environment *ev) const;
-
- virtual void Select(Environment *ev) const;
-
- virtual FW_Boolean IsFloating(Environment* ev) const;
-
- virtual void Close(Environment *ev);
- virtual void CloseAndRemove(Environment *ev);
-
-
- virtual void Show(Environment* ev);
- virtual void Hide(Environment* ev);
- FW_Boolean IsShown(Environment* ev) const;
-
- //----------------------------------------------------------------------------------------
- // New API
- //
- public:
- virtual ODID GetID(Environment *ev) const;
- virtual void SetID(Environment *ev, ODID windowID);
-
- virtual ODWindow* AcquireODWindow(Environment *ev) const;
-
- // ----- Show/Hide -----
- void ShowHide(Environment* ev,
- FW_Boolean state);
-
- // ----- Graphic Device -----
- FW_HGDevice GetGraphicDevice(Environment* ev) const;
-
- // ----- Window Title -----
- void GetWindowTitle(Environment* ev,
- FW_CString& windowTitle) const;
- void SetWindowTitle(Environment* ev,
- const FW_CString& windowTitle);
-
- // ----- Window Geometry -----
- void SetWindowSize(Environment* ev,
- const FW_CPoint& interiorSize);
- void SetWindowPosition(Environment* ev,
- const FW_CPoint& newPosition);
-
- void GetWindowSize(Environment* ev,
- FW_CPoint& interiorSize) const;
- void GetWindowPosition(Environment* ev,
- FW_CPoint& position) const;
-
- void GetBorderSize(Environment* ev,
- FW_CRect& borderSize) const;
-
- void FitToScreen(Environment* ev);
-
- // ----- Coordinate Conversion -----
- void WindowToScreen(Environment* ev,
- FW_CPoint* points,
- unsigned short nbPoint = 1);
- void ScreenToWindow(Environment* ev,
- FW_CPoint* points,
- unsigned short nbPoint = 1);
-
- void WindowToScreen(Environment* ev,
- FW_CRect& rect)
- {WindowToScreen(ev, (FW_CPoint*)&rect, 2);}
- void ScreenToWindow(Environment* ev,
- FW_CRect& rect)
- {ScreenToWindow(ev, (FW_CPoint*)&rect, 2);}
-
- //----------------------------------------------------------------------------------------
- // Internal Only
- //
- public:
- #ifdef FW_BUILD_MAC
- // ----- Mac Window Zooming -----
- void PrivMacDoZoom(Environment* ev,
- const FW_CPoint& zoomedSize,
- const FW_CRect& borderSize,
- const FW_CRect& screenRect,
- unsigned long message);
- #endif
-
- // ----- ODWindow creation -----
- void PrivOpenWindow(Environment* ev,
- ODWindow* odWindow);
-
- ODWindow* PrivCreateODWindow(Environment* ev,
- FW_CPart* thePart,
- ODFrame* parentFrame,
- FW_Boolean persistent,
- ODTypeToken viewType,
- FW_CPresentation* presentation,
- const FW_CString& windowTitle,
- const FW_CPoint& interiorSize,
- const FW_CPoint& position,
- FW_WindowStyle style);
-
- void PrivCreateODWindowForFrame(Environment* ev,
- FW_CPart* thePart,
- ODFrame* odFrame);
-
- //----------------------------------------------------------------------------------------
- // Data Members
- //
- protected:
- ODID fWindowID;
- ODSession* fSession;
-
- private:
- FW_HGDevice fGraphicDevice;
- };
-
- //========================================================================================
- // Inlines
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // FW_CWindow::ShowHide
- //----------------------------------------------------------------------------------------
- inline void FW_CWindow::ShowHide(Environment* ev, FW_Boolean state)
- {
- state ? Show(ev) : Hide(ev);
- }
-
- #endif
-