/************************************************************************/
/* Copyright 1998 MBARI							*/
/************************************************************************/
#ifndef _BARGUAGE_H
#define _BARGUAGE_H
static char BarGuage_h_id[] = "$Header: /u/oreilly/rov/tmacs/RCS/BarGuage.h,v 1.3 1998/12/18 21:07:21 oreilly Exp $";

/*
$Log: BarGuage.h,v $
Revision 1.3  1998/12/18 21:07:21  oreilly
Added documentation

Revision 1.2  1997/03/20 12:32:54  oreilly
*** empty log message ***

 * Revision 1.1  96/10/28  09:13:26  09:13:26  oreilly (Thomas C. O'Reilly)
 * Initial revision
 * 
*/

#include <Vk/VkComponent.h>
#include <Vk/VkMeter.h>
#include <Vk/VkTickMarks.h>
#include "ErrorHandler.h"
#include "Layout.h"
#include "DynamicLabel.h"

/*
CLASS 
BarGuage

DESCRIPTION
Displays value as a bar chart

AUTHOR
Tom O'Reilly
*/
class BarGuage : public VkComponent, public ErrorHandler
{
  public:
  BarGuage(const char *name, Widget parent, float minValue, float maxValue,
	   Boolean addTickMarks = False, 
	   Side tickSide = Left, 
	   const char *valueFormat = NULL);  // Must be floating point format

  ~BarGuage()
  {
    if (_valueFormat) free(_valueFormat);
  }

  virtual const char *className()
  {
    return "BarGuage";
  }
  
  // Set displayed value
  int set(float value);

  // Set min and max value
  int setRange(float minValue, float maxValue);
  
  // Set meter orientation (XmHORIZONTAL or XmVERTICAL)
  void setOrientation(unsigned char orientation)
  { 
    _meter->setOrientation(orientation);
  }

  // Set bar and background colors
  void setColors(Pixel barColor, Pixel background);
  void setBarWidth(int width);
  void setBarHeight(int height);
  
  VkTickMarks *tickMarks;
  
  protected:
  int intValue(float value);
  
  VkMeter *_meter;
  int _range;
  int _ticThickness;
  int _barThickness;
  float _minValue;
  float _maxValue;
  float _value;
  Boolean _sameSign;
//  Widget _valueText;
  DynamicLabel *_valueText;
  
  char *_valueFormat;
  
  // Colors
  Pixel _ticColor;  
  Pixel _foreground;
  Pixel _background;

  int _imax;
  double _slope;
  double _yIntercept;

  static XtResource _resources[];
  
};



#endif
