#ifndef _POWERSWITCHSTATUS_H
#define _POWERSWITCHSTATUS_H
static char PowerSwitchStatus_h_id[] = "$Header: /usr/tiburon/unix/gui/tmacs/RCS/PowerSwitchStatus.h,v 1.1 1998/05/18 20:18:09 oreilly Exp $";


/*
$Log: PowerSwitchStatus.h,v $
Revision 1.1  1998/05/18 20:18:09  oreilly
Initial revision

*/

#include <values.h>
#include "DmGuiObject.h"
#include "powerTypes.h"
#include "DynamicLabel.h"
#include "DmInputDetector.h"
#include "thrusterDM.h"

#define SWITCH_REQUEST "SWITCH_REQ"
#define SWITCH_STATUS "SWITCH_STATUS"
#define SWITCH_CURRENT "CURRENT"
#define NoCurrent -MAXSHORT

class PowerSwitchStatus : public DmGuiObject 
{
  public:

  static const char *const statusChangeCallback;

  PowerSwitchStatus(const char *name, Widget parent, 
		    const char *switchDmPrefix,
		    const char *switchName,
		    int labelWidth, int labelHeight,
		    int period, Boolean showCurrent = True);

  ~PowerSwitchStatus();

  virtual const char *className()
  {
    return "PowerSwitchStatus";
  }
  
  virtual void updateGui(DM_Item handle = 0);
  virtual void updateFromPeer(DmGuiObject *peer, void *clientData);

  switchStatus status();


  protected:
  char *_switchName;
  DynamicLabel *_label;
  DmEnumObject *_dmRequest;
  DmEnumObject *_dmStatus;
  DmInt16Object *_dmCurrent;
  DmInputDetector *_statusDetector;
  
  Pixel _noPwrForeground, _noPwrBackground;
  Pixel _onForeground, _onBackground;
  Pixel _offForeground, _offBackground;
  Pixel _faultForeground, _faultBackground;
  Int32 _status;
  Int16 _current;
  
  int requestState(switchStatus state);
  
  static XtResource _resources[];

  Boolean _showCurrent;
  
};


#endif
