/************************************************************************/
/* Copyright 1998 MBARI							*/
/************************************************************************/
#ifndef _POWERALLOCATION_H
#define _POWERALLOCATION_H
static char PowerAllocation_h_id[] = "$Header: /u/oreilly/rov/tmacs/RCS/PowerAllocation.h,v 1.4 1998/12/18 21:07:21 oreilly Exp $";

/*
$Log: PowerAllocation.h,v $
Revision 1.4  1998/12/18 21:07:21  oreilly
Added documentation

Revision 1.3  1997/05/07 17:27:34  oreilly
Delete contained DmInputDetector in destructor

 * Revision 1.2  97/03/20  12:36:22  12:36:22  oreilly (Thomas C. O'Reilly)
 * *** empty log message ***
 * 
 * Revision 1.1  96/10/28  09:13:56  09:13:56  oreilly (Thomas C. O'Reilly)
 * Initial revision
 * 
*/


#include "DmGuiObject.h"
#include "BarGuage.h"
#include "DynamicLabel.h"
#include "DmInputDetector.h"

/*
CLASS 
PowerAllocation

DESCRIPTION
Display current power usage for Power Manager subsystems

AUTHOR
Tom O'Reilly
*/
class PowerAllocation : public DmGuiObject
{
  public:
  
  PowerAllocation(const char *name, Widget parent, int period);

  ~PowerAllocation()
  {
    if (_maxAvailableDetector)
      delete _maxAvailableDetector;
  }
  
  virtual const char *className()
  {
    return "PowerAllocation";
  }
  
  virtual void updateGui(DM_Item handle = 0);
  virtual void updateFromPeer(DmGuiObject *peer, void *clientData);
  
  protected:

  void setValueString(Flt32, DynamicLabel *label);
  
  int _barWidth, _barHeight;
  
  BarGuage *_lights;
  BarGuage *_hotel;
  BarGuage *_toolSled;
  BarGuage *_thrusters;  
  BarGuage *_total;  

  DmInputDetector *_maxAvailableDetector;
  
  DynamicLabel *_lightsValue;
  DynamicLabel *_hotelValue;
  DynamicLabel *_toolSledValue;
  DynamicLabel *_thrustersValue;
  DynamicLabel *_totalValue;
  Widget _sufficient;
  Widget _maxAvailable;
  
  DmNat16Object *_dmLights;
  DmNat16Object *_dmHotel;
  DmNat16Object *_dmToolSled;
  DmNat16Object *_dmThrusters;
  DmNat16Object *_dmMaxAvailable;
  
  DmBooleanObject *_dmSufficient;
  
  Nat16 _prevLights;
  Nat16 _prevHotel;
  Nat16 _prevToolSled;
  Nat16 _prevThrusters;
  Flt32 _prevTotal;
  MBool _prevSufficient;
  
  static XtResource _resources[];
  
};


#endif

