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

  1. /* -*- Mode: C++; tab-width: 8; 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.    Component.h -- class definition for objects that have a base widget.
  20.    Created: Chris Toshok <toshok@netscape.com>, 7-Aug-96.
  21.  */
  22.  
  23.  
  24.  
  25. #ifndef _xfe_component_h
  26. #define _xfe_component_h
  27.  
  28. #include "NotificationCenter.h"
  29.  
  30. #include <Xm/Xm.h>
  31. #include "Command.h"
  32.  
  33. struct fe_colormap;  /* don't include xfe.h here, since it conflicts with our stuff. */
  34.  
  35. class XFE_Component : public XFE_NotificationCenter
  36. {
  37. public:
  38.   XFE_Component(Widget w, XFE_Component *toplevel_component = NULL);
  39.   XFE_Component(XFE_Component *toplevel_component = NULL);
  40.  
  41.   virtual ~XFE_Component();
  42.  
  43.   Widget getBaseWidget();
  44.   virtual void setBaseWidget(Widget w);
  45.   
  46.   XFE_Component *getToplevel();
  47.  
  48.   void setSensitive(Boolean sensitive);
  49.   Boolean isSensitive();
  50.  
  51.   virtual void show();
  52.   virtual void hide();
  53.   virtual void setManagedState(XP_Bool state);
  54.   virtual void toggleManagedState();
  55.  
  56.   virtual XP_Bool isShown();
  57.   virtual XP_Bool isAlive();
  58.  
  59.   virtual fe_colormap *getColormap();
  60.  
  61.   virtual Pixel getFGPixel();
  62.   virtual Pixel getBGPixel();
  63.   virtual Pixel getTopShadowPixel();
  64.   virtual Pixel getBottomShadowPixel();
  65.  
  66.   // These two methods should be belonging to a class that is above
  67.   // the Frame and Dialog Class, but below Component class
  68.   // However, since we don't have that class now, we move these two
  69.   // virtual methods from Frame.cpp to Component.cpp so that dashboard
  70.   // can query for the string regardless the dashboard is in a 
  71.   // Frame or Dialog
  72.   // tooltips and doc string
  73.   virtual char *getDocString(CommandType cmd);
  74.   virtual char *getTipString(CommandType cmd);
  75.  
  76.  
  77.   void translateFromRootCoords(int x_root, int y_root, int *x, int *y);
  78.   Boolean    isWidgetInside(Widget w);
  79.  
  80.   static const char *afterRealizeCallback; // called after we are realized, if we need to notify anyone.
  81.  
  82.   // use this method to get 'cmd.labelString' resources
  83.   // for the specified widget (default is the base widget)
  84.   char *getLabelString(char* cmd, Widget for_w=NULL);
  85.   // use this method to get 'cmd.[show|hide]LabelString' resources
  86.   // for the specified widget (default is the base widget)
  87.   char *getShowHideLabelString(char* cmd, Boolean show, Widget for_w=NULL);
  88.  
  89. protected:
  90.   XFE_Component *m_toplevel;
  91.   Widget m_widget;
  92.  
  93.   char *stringFromResource(char *command_string); // use this to get context sensitive strings
  94.   void installDestroyHandler();
  95.  
  96. private:
  97.   static void destroy_cb(Widget, XtPointer, XtPointer);
  98. };
  99.  
  100. #endif /* _xfe_component_h */
  101.