home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / macfe / gui / CHTMLClickRecord.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  3.3 KB  |  121 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. // CHTMLClickRecord.h
  20.  
  21. #pragma once
  22.  
  23. #include "lo_ele.h"
  24. #include "cstring.h"
  25. #include "Netscape_Constants.h"
  26.  
  27. class CNSContext;
  28. class CHTMLView;
  29. struct SMouseDownEvent;
  30.  
  31. class CHTMLClickRecord
  32. {
  33.     friend class CHTMLView;
  34.     friend class CBrowserView;
  35.     friend class CEditView;
  36.     
  37.     public:
  38.     
  39.         enum EClickState {
  40.             eUndefined                    =    0,
  41.             eMouseHystersis                =    6,
  42.             eMouseDragging                =    1,
  43.             eMouseTimeout,
  44.             eMouseUpEarly,
  45.             eHandledByAttachment
  46.         };
  47.         
  48.                     CHTMLClickRecord(
  49.                                 Point                 inLocalWhere,
  50.                                 const SPoint32&        inImageWhere,
  51.                                 CNSContext*         inContext,
  52.                                 LO_Element*         inElementelement,
  53.                                 CL_Layer*             inLayer = NULL);
  54.  
  55.         void                Recalc(void);
  56.  
  57.  
  58.         static Boolean         PixelReallyInElement(
  59.                                 const SPoint32&     inImagePoint,
  60.                                 LO_Element*         inElement);
  61.  
  62.         static EClickState    WaitForMouseAction(
  63.                                 const Point&         inInitialPoint,
  64.                                 Int32                inWhen,
  65.                                 Int32                inDelay);
  66.         static EClickState    WaitForMouseAction(
  67.                                 const SMouseDownEvent& inMouseDown,
  68.                                 LAttachable*        inAttachable,
  69.                                 Int32                inDelay,
  70.                                 Boolean                inExecuteContextMenuAttachment = true);
  71.                                 // This version allows a CContextMenuAttachment to work.
  72.  
  73.         Boolean                IsClickOnAnchor(void) const;
  74.         Boolean                IsClickOnEdge(void) const;
  75.         
  76.         const char*            GetClickURL() const { return (const char*)mClickURL; }
  77.         
  78.     protected:
  79.         
  80.         EClickKind            CalcImageClick(void);
  81.         EClickKind            CalcTextClick(void);
  82.         EClickKind            CalcEdgeClick(void);
  83.         
  84.         Point                mLocalWhere;
  85.         SPoint32            mImageWhere;
  86.         
  87.         LO_Element*         mElement;
  88.         LO_AnchorData*        mAnchorData;    
  89.         CNSContext*            mContext;
  90.         CL_Layer*            mLayer;
  91.         EClickKind            mClickKind;
  92.         
  93.  
  94.  
  95.         cstring                mClickURL;
  96.         cstring                mImageURL;
  97.         cstring                mWindowTarget;
  98.  
  99.             // Click in Edge members
  100.         Boolean                mIsVerticalEdge;    // If we are dragging verticaly
  101.         Int32                mEdgeUpperBound;    // top and bottom (if vertical)
  102.         Int32                mEdgeLowerBound;    // or left and right (if horizontal)
  103.  
  104.  
  105. // ÑÑ access
  106.     Boolean    IsAnchor();        // The key routine, initializes all the fields bellow
  107.     Boolean IsEdge();
  108.     void    ResetNamedWindow();    // No named windows here
  109. // ÑÑ variables
  110.     void        CalculatePosition();    // Initializes all the variables
  111.  
  112.     public:
  113.         Boolean             IsVerticalEdge(void) { return mIsVerticalEdge; };
  114.         LO_Element*         GetLayoutElement(void) { return mElement; };
  115.         SPoint32            GetImageWhere(void) { return mImageWhere; };
  116.         CL_Layer*             GetLayer(void) { return mLayer; };
  117.         
  118. };
  119.  
  120.  
  121.