home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / macfe / gui / CHTMLView.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  24.1 KB  |  849 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. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  20. //    CHTMLView.h
  21. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  22.  
  23. #pragma once
  24.  
  25. #include <LView.h>
  26. #include <LListener.h>
  27. #include <LDragAndDrop.h>
  28. #include <LDragTask.h>
  29. #include <LTabGroup.h>
  30. #include <LPeriodical.h>
  31. #include <URegions.h>
  32. #include <LArray.h>
  33.  
  34. #include <string>
  35. #include <vector.h>
  36.  
  37. #include "ntypes.h"
  38. #include "structs.h"
  39. #include "ctxtfunc.h"
  40. #include "uprefd.h"
  41. #include "layers.h"
  42. #include "CDrawable.h"
  43. #include "CBrowserDragTask.h"
  44.  
  45. #include "Events.h" // need for new fe_EventStruct - mjc
  46.  
  47. #include "net.h" // for FO_CACHE_AND_PRESENT
  48.  
  49. // The FE part of a cross-platform event. The event will get filtered
  50. // through the compositor and will be dispatched on a per-layer basis.
  51. /*
  52. typedef struct fe_EventStruct {
  53.     Point portPoint;        // The point (in port coordinates) associated with the event
  54.     void *event;            // The specifics of the event - event dependent
  55. } fe_EventStruct;
  56. */
  57.  
  58. // new typedef replaces void* with union for meaningful value on return from event dispatch.
  59. typedef struct fe_EventStruct {
  60.     Point portPoint;
  61.     union event_union {
  62.         SMouseDownEvent mouseDownEvent;
  63.         EventRecord macEvent;
  64.     } event;
  65. } fe_EventStruct;
  66.  
  67. void SafeSetCursor( ResIDT inCursorID );
  68. void FlushEventHierarchy(LView *javaAppletView);
  69. void FlushEventHierarchyRecursive(LPane *currentPane);
  70.  
  71. class CHyperScroller;
  72. class CHTMLClickRecord;
  73. class CSharableCompositor;
  74. class CSharedPatternWorld;
  75. class CURLDispatchInfo;
  76.  
  77. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  78. //    
  79. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  80.  
  81. class CHTMLView :
  82.         public COnscreenDrawable,
  83.         public LView,
  84.         public LListener,
  85.         public LDragAndDrop,
  86.         public LTabGroup,
  87.         public LPeriodical
  88. {
  89.     friend class CBrowserContext;
  90.     friend class CPluginView;
  91.     friend class CDragURLTask;
  92.  
  93.     public:
  94.     
  95.         enum { pane_ID = 'html', class_ID = 'HtVw' };
  96.         
  97.                                 CHTMLView(LStream* inStream);
  98.         virtual                    ~CHTMLView();
  99.  
  100.         virtual void            SetContext(
  101.                                     CBrowserContext*                inNewContext);
  102.  
  103.             // ACCESSORS
  104.  
  105.         CHyperScroller*            GetScroller() { return mScroller; }
  106.         
  107.         CBrowserContext*        GetContext() const { return mContext; }
  108.         Boolean                 IsBorderless(void) const;
  109.         Boolean                 IsRootHTMLView(void) const;
  110.         Boolean                 IsFocusedFrame(void) const;
  111.         
  112.         CHTMLView*                 GetSuperHTMLView(void);
  113.         void                    SetSuperHTMLView(CHTMLView *inView);
  114.         GrafPtr                    GetCachedPort(void);
  115.  
  116.         void                     SetFormElemBaseModel(LModelObject* inModel);
  117.         LModelObject*             GetFormElemBaseModel(void);
  118.  
  119.         virtual void            ResetScrollMode(Boolean inRefresh = false); // resets to default, LO_SCROLL_AUTO
  120.         // Add method to *REALLY* reset scroll mode to default scroll mode.
  121.         void                    ResetToDefaultScrollMode();
  122.         
  123.         virtual    void            SetScrollMode(
  124.                                     Int8                     inScrollMode,
  125.                                     Boolean                    inRefresh = false);
  126.         
  127.         virtual    Boolean            GetScrollMode(void) const;
  128.  
  129.         void                    SetDefaultScrollMode(Int8 inScrollMode) {mDefaultScrollMode = inScrollMode; }
  130.         void                    SetEraseBackground(Boolean inErase)    {mEraseBackground = inErase; }
  131.  
  132.         RGBColor                GetBackgroundColor() const { return mBackgroundColor; }
  133.  
  134.         virtual Int16            GetWinCSID(void) const;
  135.         virtual Int16            DefaultCSIDForNewWindow(void);
  136.         
  137.         virtual Boolean            SetDefaultCSID(Int16);
  138.         virtual void            SetFontInfo();
  139.  
  140.         void                    SetWindowBackgroundColor();
  141.         virtual void            GetDefaultFileNameForSaveAs(URL_Struct* url, CStr31& defaultName);
  142.                                     // overridden by CMessageView to use subject.
  143.  
  144.         static void                CalcStandardSizeForWindowForScreen(
  145.                                     CHTMLView*            inTopMostHTMLView,
  146.                                     const LWindow&        inWindow,
  147.                                     const Rect&            inScreenBounds,
  148.                                     SDimension16&        outStandardSize);
  149.  
  150.         void                    ClearInFocusCallAlready()
  151.                                 { mInFocusCallAlready = false; }
  152.  
  153.             // COMMANDER STUFF
  154.                         
  155.         virtual Boolean            HandleKeyPress( const EventRecord& inKeyEvent );
  156.             
  157.         virtual void             ShowView(LPane& pane);
  158.             
  159.             // PERIODICAL AND LISTENER STUFF
  160.  
  161.         virtual    void            SpendTime(const EventRecord& inMacEvent);
  162.  
  163.         virtual    void            ListenToMessage(
  164.                                     MessageT                inMessage,
  165.                                     void*                    ioParam);
  166.         
  167.             // LAYER DISPATCH
  168.                                     
  169.         virtual    void            SetLayerOrigin(
  170.                                     Int32                     inX,
  171.                                     Int32                     inY);
  172.                                     
  173.         virtual    void            GetLayerOrigin(
  174.                                     Int32*                    outX,
  175.                                     Int32*                    outY);
  176.                                     
  177.         virtual void            SetLayerClip(
  178.                                     FE_Region                 inRegion);
  179.  
  180.         virtual void            CopyPixels(
  181.                                     CDrawable*                inSrcDrawable,
  182.                                     FE_Region                inCopyRgn);
  183.  
  184.         PRBool                     HandleLayerEvent(
  185.                                     CL_Layer*                inLayer,
  186.                                     CL_Event*                inEvent);
  187.  
  188.         PRBool                     HandleEmbedEvent(    
  189.                                     LO_EmbedStruct*            inEmbed, 
  190.                                     CL_Event*                inEvent);
  191.  
  192.         void                    SetCurrentDrawable(
  193.                                     CDrawable*                inDrawable);
  194.                                     
  195.         CGrafPtr                GetCurrentPort(
  196.                                     Point&                    outPortOrigin);
  197.  
  198.             // DRAWING AND UPDATING
  199.  
  200.         virtual void            ScrollImageBy(
  201.                                         Int32                inLeftDelta,
  202.                                         Int32                inTopDelta,
  203.                                         Boolean             inRefresh);
  204.  
  205.         virtual void            AdaptToSuperFrameSize(
  206.                                         Int32                inSurrWidthDelta,
  207.                                         Int32                inSurrHeightDelta,
  208.                                         Boolean                inRefresh);
  209.  
  210.         virtual void            ResizeFrameBy(
  211.                                         Int16                 inWidthDelta,
  212.                                         Int16                 inHeightDelta,
  213.                                         Boolean             inRefresh);
  214.  
  215.         virtual Boolean            FocusDraw(
  216.                                         LPane*                 inSubPane = nil);
  217.  
  218.         virtual Boolean            EstablishPort();
  219.  
  220.         static    int                PrefUpdateCallback(
  221.                                         const char            *inPrefString,
  222.                                         void                *inCHTMLView);
  223.         static    int                PrefInvalidateCachedPreference(
  224.                                         const char            *inPrefString,
  225.                                         void                *inCHTMLView);
  226.                                         
  227.         virtual void            DrawGridEdges(RgnHandle inUpdateRgn);
  228.  
  229.     protected:
  230.         virtual void            BeTarget();
  231.         void                    SetRepaginate(Boolean inSetting);
  232.         Boolean                    GetRepaginate();
  233.  
  234.     protected:
  235.         virtual Boolean IsGrowCachingEnabled() const;
  236.  
  237.     public:
  238.  
  239.             // MOUSING
  240.         virtual void            AdjustCursorSelf(
  241.                                         Point                inPortPt,
  242.                                         const EventRecord&    inMacEvent );
  243.         void                     AdjustCursorSelfForLayer(
  244.                                         Point                inPortPt,
  245.                                         const EventRecord&    inMacEvent,
  246.                                         CL_Layer            *layer,
  247.                                         SPoint32            inLayerPt );
  248.         
  249.         virtual void            ImageToAvailScreenPoint(const SPoint32 &inImagePoint, Point &outPoint) const;
  250.             // TIMER URL
  251.         
  252.         virtual void            SetTimerURL(Uint32 inSeconds, const char* inURL);
  253.         virtual void            ClearTimerURL(void);
  254.  
  255.         inline CCharSet            GetCharSet()    { return mCharSet; }
  256.  
  257.             // FIND SUPPORT
  258.         
  259.         virtual void            CreateFindWindow();
  260.         virtual Boolean            DoFind();
  261.         
  262.             // MOUSING AND KEYING
  263.  
  264.         virtual void             PostProcessClickSelfLink(
  265.                                     const SMouseDownEvent&    inMouseDown,
  266.                                     CHTMLClickRecord&        inClickRecord,
  267.                                     Boolean                    inMakeNewWindow,
  268.                                     Boolean                    inSaveToDisk,
  269.                                     Boolean                    inDelay);
  270.  
  271.         static void             SetLastFormKeyPressDispatchTime(UInt32 inTime) { sLastFormKeyPressDispatchTime = inTime; }
  272.         
  273.         virtual void            HandleImageIconClick(CHTMLClickRecord& inClickRecord);
  274.  
  275.         
  276.     protected:
  277.  
  278.  
  279.         virtual void            DrawSelf(void);
  280.         virtual    void            DrawFrameFocus(void);
  281.         virtual    void            CalcFrameFocusMask(RgnHandle outFocusMask);
  282.         virtual    void            InvalFocusArea(void);
  283.         virtual    void             AdjustScrollBars();
  284.  
  285.         virtual void            FinishCreateSelf(void);
  286.         virtual    void            EnableSelf(void);
  287.         virtual    void            DisableSelf(void);
  288.  
  289.             // COMMANDER ISSUES
  290.  
  291.         virtual void            PutOnDuty(LCommander*);
  292.         virtual void            TakeOffDuty(void);
  293.                 void            RegisterCallBackCalls();
  294.                 void            UnregisterCallBackCalls();
  295.         
  296.     public:
  297.     
  298.         virtual void            FindCommandStatus(CommandT inCommand,
  299.                                                     Boolean    &outEnabled,
  300.                                                     Boolean    &outUsesMark,
  301.                                                     Char16    &outMark,
  302.                                                     Str255    outName);
  303.         virtual Boolean            ObeyCommand(CommandT inCommand, void* ioParam);
  304.         virtual URL_Struct*        GetURLForPrinting(Boolean& outSuppressURLCaption, 
  305.                                                     MWContext *printingContext);
  306.         
  307.     protected:
  308.     
  309.             // URL DISPATCHING
  310.         virtual void            DispatchURL(
  311.                                     URL_Struct* inURLStruct,
  312.                                     CNSContext* inTargetContext,
  313.                                     Boolean inDelay = false,
  314.                                     Boolean    inForceCreate = false,
  315.                                     FO_Present_Types inOutputFormat = FO_CACHE_AND_PRESENT
  316.                                     );
  317.     
  318.         virtual void            DispatchURL(CURLDispatchInfo* inDispatchInfo);
  319.  
  320.         Boolean                    CanPrint() const;
  321.         void                    DoPrintCommand(CommandT);
  322.         
  323. #if 0
  324.             // CONTEXTUAL POPUP
  325. // CContextMenuAttachment will make this obsolete when you decide to use it.
  326.         virtual short            DoPopup(const SMouseDownEvent& event, CHTMLClickRecord& cr);
  327. // CContextMenuAttachment will make this obsolete when you decide to use it.
  328.         virtual void            HandlePopupResult(const SMouseDownEvent& where,
  329.                                                     CHTMLClickRecord& cr,
  330.                                                     short result);
  331. #endif                
  332.             // MOUSING AND KEYING
  333.             
  334.         virtual void            Click(SMouseDownEvent &inMouseDown);
  335.         
  336.         virtual    void            ClickSelf(const SMouseDownEvent& inMouseDown);
  337.  
  338.         virtual    void            ClickSelfLayer(
  339.                                     const SMouseDownEvent&    inMouseDown,
  340.                                     CL_Layer*                inLayer,
  341.                                     SPoint32                 inLayerWhere);
  342.         
  343.         virtual    void            ClickSelfLink(
  344.                                     const SMouseDownEvent&    inMouseDown,
  345.                                     CHTMLClickRecord&        inClickRecord,
  346.                                     Boolean                    inMakeNewWindow);
  347.                                     
  348.         virtual    void            ClickDragLink(
  349.                                     const SMouseDownEvent&     inMouseDown,
  350.                                     LO_Element*             inElement);
  351.         
  352.         virtual void            ClickTrackEdge(
  353.                                     const SMouseDownEvent&    inMouseDown,
  354.                                     CHTMLClickRecord&        inClickRecord);
  355.                                     
  356.         virtual    Boolean            ClickTrackSelection(
  357.                                     const SMouseDownEvent&    inMouseDown,
  358.                                     CHTMLClickRecord&        inClickRecord);
  359.     
  360.         virtual void            EventMouseUp(const EventRecord& inMouseUp);
  361.         
  362.         virtual Boolean            HandleKeyPressLayer( const EventRecord& inKeyEvent, CL_Layer* inLayer, SPoint32 inLayerWhere );
  363.         
  364.             // Drag and Drop support
  365.         
  366.         virtual    void             DoDragSendData(
  367.                                     FlavorType                inFlavor,
  368.                                     ItemReference            inItemRef,
  369.                                     DragReference            inDragRef);
  370.                 
  371.             // NOTIFICATION RESPONSE
  372.  
  373.         virtual    void             NoteFinishedLayout(void);
  374.         virtual void            NoteAllConnectionsComplete(void);
  375.         virtual    void            NoteStartRepagination(void);
  376.         virtual    void            NoteEmptyRepagination(void);
  377.         virtual    void            NoteConfirmLoadNewURL(Boolean& ioCanLoad);
  378.         virtual    void            NoteStartLoadURL(void);
  379.         virtual    void            NoteGridContextPreDispose(Boolean inSavingHistory);
  380.         virtual    void            NoteGridContextDisposed(void);
  381.         
  382.             // DEFERRED LOADING
  383.     
  384.         virtual    void            PostDeferredImage(const char* inImageURL);
  385.         virtual    Boolean            IsImageInDeferredQueue(const char* inImageURL) const;
  386.         virtual    void            ClearDeferredImageQueue(void);
  387.         
  388.             // CONTEXT DISPATCH
  389.  
  390.         virtual void             LayoutNewDocument(
  391.                                     URL_Struct*                inURL,
  392.                                     Int32*                    inWidth,
  393.                                     Int32*                    inHeight,
  394.                                     Int32*                    inMarginWidth,
  395.                                     Int32*                    inMarginHeight);
  396.  
  397.         virtual    void            ClearView(
  398.                                     int                     inWhich = 0);
  399.     
  400.         virtual    void             ClearBackground(void);
  401.  
  402.         virtual    void             DrawBackground(
  403.                                     const Rect&             inArea,
  404.                                     LO_ImageStruct*            inBackdrop = NULL);
  405.                                     
  406.         virtual    void             DrawBackgroundSelf(
  407.                                     const Rect&             inArea,
  408.                                     LO_ImageStruct*            inBackdrop);
  409.  
  410.         virtual void             EraseBackground(
  411.                                     int                        inLocation,
  412.                                     Int32                    inX,
  413.                                     Int32                    inY,
  414.                                     Uint32                    inWidth,
  415.                                     Uint32                    inHeight,
  416.                                     LO_Color*                inColor);
  417.  
  418.         virtual int             SetColormap(
  419.                                     IL_IRGB*                inMap,
  420.                                     int                        inRequested);
  421.  
  422.         virtual void             SetBackgroundColor(
  423.                                     Uint8                     inRed,
  424.                                     Uint8                    inGreen,
  425.                                     Uint8                     inBlue);
  426.  
  427.         virtual    void            SetBackgroundImage(
  428.                                     LO_ImageStruct*         inImageStruct,
  429.                                     Boolean                 inRefresh = true);
  430.  
  431.  
  432.         virtual    void            CalcPluginMask(RgnHandle ioRgn);
  433.  
  434. //-----------------------
  435.  
  436.     public:
  437.         // needs to be public for FE_ScrollTo and FE_ScrollBy
  438.         // added default Boolean arg to scroll even if position is visible - mjc 97-9-12
  439.         virtual void             SetDocPosition(
  440.                                     int                     inLocation,
  441.                                     Int32                     inX,
  442.                                     Int32                     inY,
  443.                                     Boolean                    inScrollEvenIfVisible = false);
  444.  
  445.     protected:
  446.     
  447.         virtual void             SetDocDimension(
  448.                                     int                     inLocation,
  449.                                     Int32                     inWidth,
  450.                                     Int32                     inHeight);
  451.  
  452. #if 0
  453.         virtual void             SetDocDimensionSelf(
  454.                                     Int32                     inWidth,
  455.                                     Int32                     inHeight);
  456. #endif
  457.  
  458.         virtual void             GetDocPosition(
  459.                                     int                     inLocation,
  460.                                     Int32*                    outX,
  461.                                     Int32*                    outY);
  462.         
  463.         virtual    void             FlushPendingDocResize(void);
  464.  
  465. //------------------------                                    
  466.  
  467.         virtual int                GetTextInfo(
  468.                                     LO_TextStruct*            inText,
  469.                                     LO_TextInfo*            outTextInfo);
  470.  
  471.         virtual int                MeasureText(
  472.                                     LO_TextStruct*            inText,
  473.                                     short*                    outCharLocs);
  474.             
  475.         virtual void            GetTextFrame(
  476.                                     LO_TextStruct*            inTextStruct,
  477.                                     Int32                    inStartPos,
  478.                                     Int32                    inEndPos,
  479.                                     XP_Rect*                outFrame);
  480.  
  481.         virtual void             DisplaySubtext(
  482.                                     int                     inLocation,
  483.                                     LO_TextStruct*            inText,
  484.                                     Int32                     inStartPos,
  485.                                     Int32                    inEndPos,
  486.                                     XP_Bool                 inNeedBG);
  487.  
  488.         virtual void             DisplayText(
  489.                                     int                     inLocation,
  490.                                     LO_TextStruct*            inText,
  491.                                     XP_Bool                 inNeedBG);
  492.  
  493.         virtual void             DisplayLineFeed(
  494.                                     int                     inLocation,
  495.                                     LO_LinefeedStruct*        inLinefeedStruct,
  496.                                     XP_Bool                 inNeedBG);
  497.  
  498.         virtual void             DisplayHR(
  499.                                     int                     inLocation,
  500.                                     LO_HorizRuleStruct*        inRuleStruct);
  501.  
  502.         virtual void             DisplayBullet(
  503.                                     int                     inLocation,
  504.                                     LO_BullettStruct*        inBulletStruct);
  505.  
  506. //-----------------------
  507.             
  508.     protected:
  509.     
  510.         virtual void             GetEmbedSize(
  511.                                     LO_EmbedStruct*            inEmbedStruct,
  512.                                     NET_ReloadMethod        inReloadMethod);
  513.                                     
  514.         virtual void            FreeEmbedElement(
  515.                                     LO_EmbedStruct*            inEmbedStruct);
  516.  
  517.         virtual void             CreateEmbedWindow(
  518.                                     NPEmbeddedApp*            inEmbeddedApp);
  519.  
  520.         virtual void             SaveEmbedWindow(
  521.                                     NPEmbeddedApp*            inEmbeddedApp);
  522.  
  523.         virtual void             RestoreEmbedWindow(
  524.                                     NPEmbeddedApp*            inEmbeddedApp);
  525.  
  526.         virtual void             DestroyEmbedWindow(
  527.                                     NPEmbeddedApp*            inEmbeddedApp);
  528.  
  529.         virtual void             DisplayEmbed(
  530.                                     int                     inLocation,
  531.                                     LO_EmbedStruct*            inEmbedStruct);
  532.  
  533. //-----------------------
  534.             
  535.     protected:
  536.     
  537.         virtual void             GetJavaAppSize(
  538.                                     LO_JavaAppStruct*        inJavaAppStruct,
  539.                                     NET_ReloadMethod        inReloadMethod);
  540.  
  541.         virtual void             FreeJavaAppElement(
  542.                                     LJAppletData*            inAppletData);
  543.  
  544.         virtual void             HideJavaAppElement(
  545.                                     LJAppletData*            inAppletData);
  546.                                     
  547.         virtual void             DisplayJavaApp(
  548.                                     int                     inLocation,
  549.                                     LO_JavaAppStruct*        inJavaAppStruct);
  550.  
  551.         virtual    void             DrawJavaApp(
  552.                                     int                     inLocation,
  553.                                     LO_JavaAppStruct*        inJavaAppStruct);
  554.                                             
  555.         virtual    void             HandleClippingView(
  556.                                     struct LJAppletData     *appletD, 
  557.                                     int                     x, 
  558.                                     int                     y, 
  559.                                     int                     width, 
  560.                                     int                     height);
  561. //-----------------------
  562.  
  563.     protected:
  564.     
  565.         virtual void             GetFormElementInfo(
  566.                                     LO_FormElementStruct*     inElement);
  567.  
  568. /*
  569.     nothing view-specific about these routines, so the BrowserContext just calls thru
  570.     to the status functions in UFormElementFactory.
  571.     deeje 97-02-13
  572.     
  573.         virtual void             GetFormElementValue(
  574.                                     LO_FormElementStruct*     inElement,
  575.                                     XP_Bool                 inHide);
  576.  
  577.         virtual void             ResetFormElement(
  578.                                     LO_FormElementStruct*     inElement);
  579.  
  580.         virtual void             SetFormElementToggle(
  581.                                     LO_FormElementStruct*     inElement,
  582.                                     XP_Bool                 inToggle);
  583.  
  584.         virtual void             FormTextIsSubmit(
  585.                                     LO_FormElementStruct*     inElement);
  586. */
  587.  
  588.         virtual    void             ResetFormElementData(
  589.                                     LO_FormElementStruct*    inElement,
  590.                                     Boolean                 inRefresh,
  591.                                     Boolean                    inFromDefaults);
  592.  
  593.         virtual void             DisplayFormElement(
  594.                                     int                     inLocation,
  595.                                     LO_FormElementStruct*     inFormElement);
  596.  
  597.         virtual void             DisplayBorder(
  598.                                     int                     inLocation,
  599.                                     int                        inX,
  600.                                     int                        inY,
  601.                                     int                        inWidth,
  602.                                     int                        inHeight,
  603.                                     int                        inBW,
  604.                                     LO_Color*                 inColor,
  605.                                     LO_LineStyle            inStyle);
  606.  
  607.         virtual void            UpdateEnableStates();
  608.         
  609.         virtual void             DisplayFeedback(
  610.                                     int                     inLocation,
  611.                                     LO_Element*                inElement);
  612.  
  613. //-----------------------
  614.             
  615.     protected:
  616.     
  617.         virtual void             FreeEdgeElement(
  618.                                     LO_EdgeStruct*            inEdgeStruct);
  619.  
  620.         virtual void             DisplayEdge(
  621.                                     int                     inLocation,
  622.                                     LO_EdgeStruct*            inEdgeStruct);
  623.  
  624. //-----------------------
  625.  
  626.     protected:
  627.     
  628.         virtual void             DisplayTable(
  629.                                     int                     inLocation,
  630.                                     LO_TableStruct*            inTableStruct);
  631.  
  632.         virtual void             DisplayCell(
  633.                                     int                     inLocation,
  634.                                     LO_CellStruct*            inCellStruct);
  635.  
  636.         virtual    void             InvalidateEntireTableOrCell(
  637.                                     LO_Element*                inElement);
  638.  
  639.         virtual    void             DisplayAddRowOrColBorder(
  640.                                     XP_Rect*                inRect,
  641.                                     XP_Bool                    inDoErase);
  642.  
  643.  
  644.         virtual    Boolean            CalcElementPosition(
  645.                                     LO_Element*             inElement,
  646.                                     Rect&                     outFrame);
  647.  
  648.         virtual void            CalcAbsoluteElementPosition(
  649.                                     LO_Element*                inElement,
  650.                                     XP_Rect&                outFrame);
  651.  
  652.         // Support for style sheet borders
  653.         virtual void            DisplaySolidBorder(
  654.                                     const Rect&                inFrame,
  655.                                     const RGBColor&            inBorderColor,
  656.                                     Int32                    inTopWidth,
  657.                                     Int32                    inLeftWidth,
  658.                                     Int32                    inBottomWidth,
  659.                                     Int32                    inRightWidth);
  660.  
  661.         virtual void            DisplayBevelBorder(
  662.                                     const Rect&                inFrame,
  663.                                     const RGBColor&            inBorderColor,
  664.                                     Boolean                    inRaised,
  665.                                     Int32                    inTopWidth,
  666.                                     Int32                    inLeftWidth,
  667.                                     Int32                    inBottomWidth,
  668.                                     Int32                    inRightWidth);
  669.  
  670.         virtual void            DisplayGrooveRidgeBorder(
  671.                                     const Rect&                inFrame,
  672.                                     const RGBColor&            inBorderColor,
  673.                                     Boolean                    inIsGroove,
  674.                                     Int32                    inTopWidth,
  675.                                     Int32                    inLeftWidth,
  676.                                     Int32                    inBottomWidth,
  677.                                     Int32                    inRightWidth);
  678. //-----------------------
  679.  
  680.     protected:
  681.     
  682.         virtual    void             CreateGridView(
  683.                                     CBrowserContext*        inGridContext,
  684.                                     Int32                    inX,
  685.                                     Int32                     inY,
  686.                                     Int32                    inWidth,
  687.                                     Int32                    inHeight,
  688.                                     Int8                    inScrollMode,
  689.                                     Bool                     inNoEdge);
  690.  
  691.         virtual    void             CropFrameToContainer(
  692.                                     Int32                    inImageLeft,
  693.                                     Int32                    inImageTop,
  694.                                     Int32                    inImageWidth,
  695.                                     Int32                    inImageHeight,
  696.                                     Rect&                    outLocalFrame) const;
  697.  
  698.         virtual    void            RestructureGridView(
  699.                                     Int32                    inX,
  700.                                     Int32                     inY,
  701.                                     Int32                    inWidth,
  702.                                     Int32                    inHeight);    
  703.  
  704.         virtual    void            GetFullGridSize(
  705.                                     Int32&                    outWidth,
  706.                                     Int32&                    outHeight);
  707.     
  708. //-----------------------
  709.  
  710.     protected:
  711.     
  712.         virtual void            InstallBackgroundColor(void);
  713.                                     // Sets mBackgroundColor. Called from ClearBackground().
  714.                                     // The base class implementation uses the text background
  715.                                     // preference, but derived classes can override this.
  716.  
  717.         virtual void            GetDefaultBackgroundColor(LO_Color* outColor) const;
  718.                                     // Called by layout before setting the background color
  719.                                     // of a context.  The view can leave it alone (which will
  720.                                     // use the global default background color) or override it.
  721.  
  722.         virtual void            ResetBackgroundColor() const;
  723.                                     // Calls RGBBackColor(mBackgroundColor).  Printview overrides.
  724.  
  725.         Boolean                    ContextMenuPopupsEnabled (void);
  726.                                     
  727.         inline void                LocalToLayerCoordinates(
  728.                                     const XP_Rect&            inBoundingBox,
  729.                                     Point                    inWhereLocal,
  730.                                     SPoint32&                outWhereLayer) const;
  731.  
  732. //    char *            fURLTimer;        // URL to load when timer goes off
  733. //    UInt32            fURLFireTime;    // When this url should be fired up
  734.  
  735.  
  736. //-----------------------
  737. //    Data
  738.  
  739.     protected:
  740.     
  741.         CBrowserContext*        mContext;
  742.  
  743.         RGBColor                mBackgroundColor;
  744.         LO_ImageStruct*         mBackgroundImage;
  745.         Boolean                    mEraseBackground;
  746.  
  747.     private:
  748.         CHTMLView*                mSuperHTMLView;
  749.  
  750.     protected:
  751.  
  752.         Boolean                    mNoBorder;
  753.         Boolean                    mHasGridCells;
  754.         Boolean                    mShowFocus;
  755.         GrafPtr                    mCachedPort;
  756.     
  757.         string                    mTimerURL;
  758.         vector<string>            mImageQueue;
  759.  
  760.         LModelObject*             mElemBaseModel;
  761.         
  762.         Int8                    mScrollMode;    // LO_SCROLL_YES, LO_SCROLL_NO, and LO_SCROLL_AUTO
  763.         Int8                    mDefaultScrollMode;    // same
  764.         CCharSet                mCharSet;
  765.  
  766.         SDimension32            mPendingDocDimension;
  767.         Boolean                        mPendingDocDimension_IsValid;
  768.  
  769.         StRegion                mSaveLayerClip;
  770.         RgnHandle                mLayerClip;
  771.         SPoint32                mLayerOrigin;
  772.         CSharableCompositor*    mCompositor;
  773.  
  774.         DragSendDataUPP         mSendDataUPP;
  775.  
  776.         LO_Element*                mDragElement;
  777.         
  778.         Uint32                    mTimerURLFireTime;
  779.         char*                    mTimerURLString;
  780.  
  781.         CRouterDrawable*        mOnscreenDrawable;
  782.         COffscreenDrawable*        mOffscreenDrawable;
  783.         CDrawable*                mCurrentDrawable;
  784.  
  785.         CSharedPatternWorld*     mPatternWorld;
  786.         Boolean                    mNeedToRepaginate;
  787.         
  788.         Point                    mOldPoint;    // Last place cursor was adjusted. No initializing
  789.         long                    mOldEleID;    // Last anchor text block whose URL we displayed. No initializing
  790.  
  791.         // 97-06-11 pkc -- Add vector to keep track of grid edges and flag that tells us
  792.         // not to add LO_EdgeStruct* to vector because it's already in vector
  793.         vector<LO_EdgeStruct*>    mGridEdgeList;
  794.         Boolean                    mDontAddGridEdgeToList;
  795.  
  796.         Boolean                    mLoadingURL;
  797.         Boolean                    mStopEnablerHackExecuted;
  798.         
  799.         Boolean                    mInFocusCallAlready;
  800.         static Boolean            sCachedAlwaysLoadImages; // Caches general.always_load_images
  801.         
  802. // FIX ME!!! the following things need to be removed in another pass
  803.  
  804.         CHyperScroller*            mScroller;
  805.         // Set this when we dispatch a key event to a form, to prevent an infinite loop
  806.         // (otherwise, if the form doesn't handle the key, the event will get passed up
  807.         // the chain, and the html view will dispatch the same event to layers).
  808.         static UInt32            sLastFormKeyPressDispatchTime;
  809.         // Set when a mouse down is dispatched, so the view's mouse up handlers don't
  810.         // otherwise get called.
  811.         Boolean                    mWaitMouseUp;
  812.         CHTMLClickRecord*        mCurrentClickRecord;
  813.             // So that FindCommandStatus can use it for disabling context menu items.
  814.             // This will be non-null only when testing or executing context menu commands.
  815. }; // class CHTMLView
  816.  
  817.  
  818. inline GrafPtr CHTMLView::GetCachedPort(void)
  819.     {    return  mCachedPort;        }
  820.     
  821.     
  822. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  823. //    
  824. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  825.  
  826. class CDragURLTask : public CBrowserDragTask
  827. {
  828. public:
  829.     typedef CBrowserDragTask super;
  830.     
  831.                     CDragURLTask(
  832.                                     const EventRecord&    inEventRecord,
  833.                                     const Rect&         inGlobalFrame,
  834.                                     CHTMLView&             inHTMLView);
  835.  
  836.     virtual void    AddFlavors(
  837.                                     DragReference        inDragRef);
  838.     virtual void    MakeDragRegion(
  839.                                     DragReference        inDragRef,
  840.                                     RgnHandle            inDragRegion);
  841.                                     
  842. protected:
  843.     Rect            mGlobalFrame;
  844.     CHTMLView&        mHTMLView;
  845. };
  846.  
  847.  
  848.  
  849.