home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / macfe / gui / CBrowserWindow.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  8.1 KB  |  237 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. #pragma once
  20.  
  21. #include <LListener.h>
  22. #include "CWindowMediator.h"
  23. #include "CNetscapeWindow.h"
  24. #include "CProgressListener.h"
  25. #include "CSaveWindowStatus.h"
  26. #include "divview.h"
  27.  
  28. #include "ntypes.h"
  29.  
  30. // menubar manager will adjust menubar according to browser window's menubar mode
  31. typedef enum {
  32.     BrWn_Menubar_None, // hide menubar
  33.     BrWn_Menubar_Minimal, // File and Edit menus only
  34.     BrWn_Menubar_Default // standard browser window menubar
  35. } BrWn_Menubar_Mode;
  36.  
  37.  
  38. class CBrowserContext;
  39. class CNSContext; // mjc
  40. class CHTMLView;
  41. class CRDFCoordinator;
  42.  
  43.  
  44. class CBrowserWindow : public CNetscapeWindow, public CSaveWindowStatus, public LListener
  45. {
  46.     public:
  47.         enum { class_ID = 'BrWn', 
  48.                 res_ID = 1010, 
  49.                 dialog_res_ID = 1013, 
  50.                 titlebarless_res_ID = 1012, 
  51.                 floating_res_ID = 1014};
  52.                 
  53.         enum EBooleanParms {
  54.             kShow        = true,
  55.             kDontShow    = false,
  56.             kSelect        = true,
  57.             kDontSelect    = false
  58.         };
  59.         
  60.         typedef CNetscapeWindow super;
  61.                         
  62.                                 CBrowserWindow(LStream* inStream);
  63.         virtual                    ~CBrowserWindow();
  64.         
  65.         virtual    void            SetWindowContext(CBrowserContext* inContext);
  66.         virtual    CNSContext*        GetWindowContext() const;
  67.  
  68.  
  69.         virtual void            FindCommandStatus(
  70.                                         CommandT            inCommand,
  71.                                         Boolean                &outEnabled,
  72.                                         Boolean                &outUsesMark,
  73.                                         Char16                &outMark,
  74.                                         Str255                outName);
  75.  
  76.         virtual Boolean            HandleKeyPress(const EventRecord &inKeyEvent);
  77.  
  78.         virtual Boolean            ObeyCommand(
  79.                                         CommandT            inCommand,
  80.                                         void                *ioParam = nil);
  81.  
  82.         virtual    void            ListenToMessage(
  83.                                         MessageT            inMessage,
  84.                                         void*                 ioParam);
  85.         
  86.         virtual void            AttemptClose(void);
  87.                                 
  88.         virtual void            DoClose(void)
  89.                                 {
  90.                                     AttemptCloseWindow();
  91.                                     CMediatedWindow::DoClose();
  92.                                 }
  93.                                 
  94.                                     // deeje 1997-01-13
  95.                                 // inFirstTime can be specified when setting chrome info on a window for the first time.
  96.                                 // This allows some parameters to be set once and locked (eg. size of non-resizable window).
  97.         virtual void            SetChromeInfo(Chrome* theChrome, Boolean inNotifyMenuBarModeChanged = false, Boolean inFirstTime = false);
  98.         virtual void            GetChromeInfo(Chrome* theChrome);
  99.         
  100.         static CBrowserWindow*    MakeNewBrowserWindow(Boolean inShow = kShow, Boolean inSelect = kSelect);
  101.  
  102.         // FindAndShow returns an empty new CBrowserWindow without putting
  103.         // a new CNSContext in the window
  104.         static CBrowserWindow*    FindAndShow(Boolean inMakeNew = false);
  105.         // FindAndPrepare returns a new CBrowserWindow with a CNSContext already
  106.         // hooked in the window
  107.         static CBrowserWindow*    FindAndPrepareEmpty(Boolean inMakeNew = false);
  108.         
  109.         static CBrowserWindow*    WindowForContext(CBrowserContext* inContext);
  110.  
  111.         static CBrowserWindow*    GetWindowByID(const Int32 windowID);
  112.  
  113.         virtual void            Select(); // mjc modified for always on bottom
  114.         virtual void            ActivateSelf();
  115.                 
  116.         virtual void            ClickInDrag(const EventRecord &inMacEvent);
  117.         virtual void            ClickInGrow(const EventRecord &inMacEvent);
  118.         
  119.         // override to send javascript move, resize, and zoom events
  120.         // these might be called from handling an AppleEvent.
  121.         virtual void    DoSetPosition(Point inPosition);
  122.         virtual void    DoSetBounds(const Rect &inBounds);
  123.         virtual void    DoSetZoom(Boolean inZoomToStdState);
  124.  
  125.         virtual void    CalcStandardBoundsForScreen(
  126.                                                 const Rect&        inScreenBounds,
  127.                                                 Rect&            outStdBounds) const;
  128.  
  129.         virtual BrWn_Menubar_Mode GetMenubarMode() { return mMenubarMode; }
  130.         
  131.         virtual Boolean            IsRestrictedTarget(void);
  132.         Boolean                    IsAlwaysLowered(void) { return mAlwaysOnBottom; }
  133.         Boolean                    IsZLocked(void) { return mZLocked; }
  134.         Boolean                    CommandsAreDisabled(void) { return mCommandsDisabled; }
  135.         
  136.         // AppleEvent support
  137.         virtual void            HandleAppleEvent(
  138.                                         const AppleEvent    &inAppleEvent,
  139.                                         AppleEvent            &outAEReply,
  140.                                         AEDesc                &outResult,
  141.                                         Int32                inAENumber);
  142.  
  143.         void                    SendAEGetURL(const char* url);
  144.         void                     SendAEGo( OSType direction ); // mjc
  145.         void                    DoAEGo(OSType direction);
  146.  
  147.         static void     HandleGetURLEvent(
  148.                                 const AppleEvent    &inAppleEvent,
  149.                                 AppleEvent            &outAEReply,
  150.                                 AEDesc                &outResult,
  151.                                 CBrowserWindow*        inBrowserWindow = nil);
  152.         static void     HandleOpenURLEvent(
  153.                                 const AppleEvent    &inAppleEvent,
  154.                                 AppleEvent            &outAEReply,
  155.                                 AEDesc                &outResult,
  156.                                 CBrowserWindow*        inBrowserWindow = nil);
  157.  
  158.         // enable/disable subview's context-sensitive popup menus
  159.         void            AllowSubviewPopups (Boolean inAllow)
  160.                             { mAllowSubviewPopups = inAllow; }
  161.         Boolean            AllowSubviewPopups (void)
  162.                             { return mAllowSubviewPopups; }
  163.                                 
  164.         Boolean            IsRootDocInfo() { return mIsRootDocInfo; }
  165.         Boolean            IsViewSource() { return mIsViewSource; }
  166.         Boolean            IsHTMLHelp() { return mIsHTMLHelp; }
  167.                                 
  168.         // override to send javascript move and resize events when the user performs the action
  169.         // because ClickInDrag moves the window but doesn't execute its AppleEvent.
  170.         virtual void    SendAESetPosition(Point inPosition, Boolean inExecuteAE);
  171.         
  172.         // I18N stuff
  173.         virtual Int16            DefaultCSIDForNewWindow(void);
  174.         virtual Int16             GetDefaultCSID(void) const;
  175.         
  176.         
  177.             // better bookmarks support
  178.         virtual void            DoDefaultPrefs();
  179.         
  180.             // AEOM support
  181.         virtual void        GetAEProperty(DescType inProperty,
  182.                                           const AEDesc &inRequestedType,
  183.                                           AEDesc& outPropertyDesc) const;
  184.  
  185.         
  186.     protected:
  187.         virtual    void                FinishCreateSelf(void);
  188.         const CHTMLView*            GetHTMLView() const { return mHTMLView; }
  189.         CHTMLView*                    GetHTMLView() { return mHTMLView; }
  190.         const CRDFCoordinator*        GetNavCenterParentView() const { return mNavCenterParent; }
  191.         CRDFCoordinator*            GetNavCenterParentView() { return mNavCenterParent; }
  192.  
  193.         virtual void            HandleNetSearchCommand();
  194.  
  195.         virtual    void            NoteDocTitleChanged(const char* inTitle);
  196.         virtual void            NoteBeginLayout(void);
  197.         virtual    void            NoteFinishedLayout(void);
  198.         virtual void            NoteAllConnectionsComplete(void);
  199.  
  200.         virtual ResIDT            GetStatusResID(void) const { return res_ID; }
  201.         virtual UInt16            GetValidStatusVersion(void) const { return 0x0113; }
  202.         
  203.         virtual void            ShowStatus(Chrome* inChromeInfo); // 97-05-12 pkc -- pass in Chrome struct
  204.         
  205.         virtual void            ShowDragBars(Boolean inShowNavBar, Boolean inShowLocBar, Boolean inShowDirBar); // mjc
  206.         
  207.         void                    ClearSystemGrowIconBevel();
  208.         void                    SetSystemGrowIconBevel();
  209.  
  210.         void                    WriteWindowStatus ( LStream *outStatusData ) ;
  211.         void                    ReadWindowStatus ( LStream *outStatusData ) ;
  212.         
  213.         // I18N stuff
  214.         virtual void             SetDefaultCSID(Int16);
  215.         
  216. //Boolean mIsTitled;
  217.  
  218.         CBrowserContext*        mContext;
  219.         CProgressListener*        mProgressListener;
  220.         Boolean                    mAlwaysOnBottom; // javascript alwaysLowered window property - mjc
  221.         Boolean                    mZLocked; // javascript z-lock window property
  222.         BrWn_Menubar_Mode        mMenubarMode; // specifies menubar for window
  223.         Boolean                    mCommandsDisabled; // javascript hotkeys window option
  224.         
  225.         ProcessSerialNumber        fCloseNotifier;        // apple event support
  226.         Boolean                    mSupportsPageServices;
  227.         Boolean                    mAllowSubviewPopups;
  228.         
  229.         Boolean                    mIsRootDocInfo;
  230.         Boolean                    mIsViewSource;
  231.         Boolean                    mIsHTMLHelp;
  232.         
  233.     private:
  234.         CRDFCoordinator*        mNavCenterParent;            // top level of navcenter hierarchy
  235.         CHTMLView*                mHTMLView;
  236. };
  237.