home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / xfe / src / HTMLView.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  5.0 KB  |  148 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.    HTMLView.h -- class definition for the HTML view class
  20.    Created: Spence Murray <spence@netscape.com>, 23-Oct-96.
  21.  */
  22.  
  23.  
  24.  
  25. #ifndef _xfe_htmlview_h
  26. #define _xfe_htmlview_h
  27.  
  28. #include "structs.h"
  29. #include "mozilla.h"
  30. #include "xfe.h"
  31.  
  32. #include "PopupMenu.h"
  33. #include "Menu.h"
  34. #include "View.h"
  35. #include "Command.h"
  36.  
  37. #define DO_NOT_PASS_LAYER_N_EVENT 1
  38.  
  39. class XFE_HTMLView : public XFE_View
  40. {
  41. public:
  42.   XFE_HTMLView(XFE_Component *toplevel_component, Widget parent, XFE_View *parent_view, MWContext *context);
  43.  
  44.   virtual ~XFE_HTMLView();
  45.  
  46.   virtual int getURL(URL_Struct *url, Boolean skip_get_url);
  47.  
  48.   // this gets called by our toplevel to let us do some things
  49.   // after it's been realized, but before we're on the screen.
  50.   XFE_CALLBACK_DECL(beforeToplevelShow)
  51.  
  52.   // this gets called when links attribute is changed
  53.   XFE_CALLBACK_DECL(ChangeLinksAttribute)
  54.  
  55.   // this gets called when any default color is changed
  56.   XFE_CALLBACK_DECL(ChangeDefaultColors)
  57.  
  58.   // this gets called when default font is changed
  59.   XFE_CALLBACK_DECL(ChangeDefaultFont)
  60.  
  61.   virtual Boolean isCommandEnabled(CommandType cmd, void *calldata = NULL,
  62.                                    XFE_CommandInfo* i = NULL);
  63.   virtual void doCommand(CommandType, void *calldata = NULL,
  64.                                    XFE_CommandInfo* i = NULL);
  65.   virtual Boolean handlesCommand(CommandType cmd, void *calldata = NULL,
  66.                                    XFE_CommandInfo* i = NULL);
  67.   virtual char* commandToString(CommandType cmd, void *calldata = NULL,
  68.                                    XFE_CommandInfo* i = NULL);
  69.   virtual XP_Bool isCommandSelected(CommandType cmd, void *calldata = NULL,
  70.                          XFE_CommandInfo* = NULL);
  71.  
  72.   virtual void    setScrollbarsActive(XP_Bool b);
  73.  
  74.   // interrogation of HTMLView's contents.
  75.   void translateToDocCoords(int x, int y, int *doc_x, int *doc_y);
  76.  
  77.   URL_Struct *URLAtPosition(int x, int y, CL_Layer *layer=NULL);
  78.   URL_Struct *imageURLAtPosition(int x, int y, CL_Layer *layer=NULL);
  79.   LO_Element *layoutElementAtPosition(int x, int y, CL_Layer *layer=NULL);
  80.  
  81.   void doPopup(MWContext *context, CL_Layer *layer,
  82.            CL_Event *layer_event);
  83.  
  84.     URL_Struct *URLUnderMouse();
  85.     URL_Struct *ImageUnderMouse();
  86.     URL_Struct *BackgroundUnderMouse();
  87.  
  88. #if DO_NOT_PASS_LAYER_N_EVENT
  89.   virtual void tipCB(MWContext *context, int x, int y, char* alt_text,
  90.                      XtPointer cb_data);
  91. #else
  92.   virtual void tipCB(MWContext *context, CL_Layer *layer,
  93.                      CL_Event *layer_event, XtPointer cb_data);
  94. #endif
  95.     XFE_PopupMenu* getPopupMenu();
  96.     void           setPopupMenu(XFE_PopupMenu*);
  97.  
  98.   static const char *newURLLoading; // called whenever a new page is loading -- the url needs to change
  99.   static const char *spacebarAtPageBottom; // called when space is hit at the bottom of the page.
  100.   static const char *popupNeedsShowing; // called so that containing views can override the htmlview's popup.
  101.  
  102. protected:
  103.   XFE_PopupMenu *m_popup;
  104.  
  105. private:
  106.   Widget m_scrollerForm;
  107.  
  108.   static MenuSpec separator_spec[];
  109.   static MenuSpec openLinkNew_spec[];
  110.   static MenuSpec openFrameNew_spec[];
  111.   static MenuSpec openLinkEdit_spec[];
  112.   static MenuSpec go_spec[];
  113.   static MenuSpec showImage_spec[];
  114.   static MenuSpec stopLoading_spec[];
  115.   static MenuSpec page_details_spec[];
  116.   static MenuSpec openImage_spec[];
  117.   static MenuSpec addLinkBookmark_spec[];
  118.   static MenuSpec addFrameBookmark_spec[];
  119.   static MenuSpec addBookmark_spec[];
  120.   static MenuSpec sendPage_spec[];
  121.   static MenuSpec saveLink_spec[];
  122.   static MenuSpec saveImage_spec[];
  123.   static MenuSpec saveBGImage_spec[];
  124.   static MenuSpec copy_spec[];
  125.   static MenuSpec copyLink_spec[];
  126.   static MenuSpec copyImage_spec[];
  127.  
  128.   URL_Struct *m_urlUnderMouse;
  129.   URL_Struct *m_imageUnderMouse;
  130.   URL_Struct *m_backgroundUnderMouse;
  131.  
  132.   void makeScroller(Widget parent);
  133.   void findLayerForPopupMenu(Widget widget, XEvent *event);
  134.   void reload(Widget, XEvent *event, XP_Bool onlyReloadFrame = FALSE);
  135.   void openFileAction (String *av, Cardinal *ac);
  136.  
  137.   // This gets called by our toplevel when the encoding has
  138.   // changed for this window.
  139.   XFE_CALLBACK_DECL(DocEncoding)
  140. };
  141.  
  142. extern "C" void fe_HTMLViewDoPopup (MWContext *context, 
  143.                     CL_Layer *layer,
  144.                     CL_Event *layer_event);
  145.  
  146. #endif /* _xfe_htmlview_h */
  147.  
  148.