home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / xfe / src / View.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  3.8 KB  |  109 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.    XFEView.h -- class definition for XFEView
  20.    Created: Chris Toshok <toshok@netscape.com>, 7-Aug-96.
  21.  */
  22.  
  23.  
  24.  
  25. #ifndef _xfe_xfeview_h
  26. #define _xfe_xfeview_h
  27.  
  28. #include "structs.h"
  29. #include "xp_core.h"
  30.  
  31. #include "Command.h"
  32. #include "Component.h"
  33.  
  34. class XFE_View : public XFE_Component
  35. {
  36. public:
  37.   XFE_View(XFE_Component *toplevel_component, XFE_View *parent_view = NULL, MWContext *context = NULL);
  38.   virtual ~XFE_View();
  39.  
  40.   XFE_View*    getParent();
  41.   void        setParent(XFE_View *parent_view);
  42.   MWContext*    getContext();
  43.   int        getNumSubViews();
  44.  
  45.   /* The view that is returned is either this view or one of it's sub views. */
  46.   virtual XFE_View* widgetToView(Widget w);
  47.  
  48.   /* These are the methods that views will want to overide to add
  49.      their own functionality. */
  50.  
  51.   /* this method is used by the toplevel to sensitize menu/toolbar items. */
  52.   virtual Boolean isCommandEnabled(CommandType cmd, void *calldata = NULL,
  53.                                    XFE_CommandInfo* m = NULL);
  54.  
  55.   /* this method is used by the toplevel to dispatch a command. */
  56.   virtual void doCommand(CommandType cmd, void *calldata = NULL,
  57.                          XFE_CommandInfo* i = NULL);
  58.  
  59.   /* used by toplevel to see which view can handle a command.  Returns true
  60.      if we can handle it. */
  61.   virtual Boolean handlesCommand(CommandType cmd, void *calldata = NULL, 
  62.                                  XFE_CommandInfo* i = NULL);
  63.  
  64.   /* used by toplevel to change the labels specified in menu items.  Return NULL
  65.      if no change. */
  66.   virtual char* commandToString(CommandType cmd, void *calldata = NULL,
  67.                                 XFE_CommandInfo* i = NULL);
  68.  
  69.   /* used by toplevel to change the selection state of specified toggle menu 
  70.      items.  This method only applies to toggle button */
  71.   virtual Boolean isCommandSelected(CommandType cmd, void *calldata = NULL,
  72.                                     XFE_CommandInfo* i = NULL);
  73.  
  74.   virtual XFE_Command* getCommand(CommandType) { return NULL; };
  75.   virtual XFE_View*    getCommandView(XFE_Command*);
  76.  
  77.   static const char *chromeNeedsUpdating; // update all the chrome in this window
  78.   static const char *commandNeedsUpdating; // update the status of one command -- sent in calldata
  79.   static const char *statusNeedsUpdating; // update status to a string -- sent in calldata
  80.   static const char *statusNeedsUpdatingMidTruncated; // update status to mid-truncated string -- sent in calldata
  81.  
  82.   virtual Pixel getFGPixel();
  83.   virtual Pixel getBGPixel();
  84.   virtual Pixel getTopShadowPixel();
  85.   virtual Pixel getBottomShadowPixel();
  86.  
  87.   virtual void    setScrollbarsActive(XP_Bool b);
  88.   virtual XP_Bool getScrollbarsActive();
  89.  
  90.     // tooltips and doc string
  91.     virtual char *getDocString(CommandType /* cmd */) {return NULL;}
  92.     virtual char *getTipString(CommandType /* cmd */) {return NULL;}
  93.  
  94. protected:
  95.   MWContext *m_contextData; // the MWContext *
  96.   virtual void addView(XFE_View *new_view);
  97.   virtual Boolean hasSubViews();
  98.  
  99.    // list of children
  100.   XFE_View **m_subviews;
  101.   int m_numsubviews;
  102.   int m_numsubviews_allocated;
  103.   XP_Bool m_areScrollbarsActive;
  104. private:
  105.   XFE_View *m_parentView;
  106. };
  107.  
  108. #endif /* _xfe_xfeview_h */
  109.