//  
//  Copyright (c) 1994 by Mike Romberg (  romberg@md.fsl.noaa.gov )
//  Debugged and Featurized by Michael Hemy
//
//  This file may be distributed under terms of the GPL
//

#ifndef _FIELDMETER_H_
#define _FIELDMETER_H_

#include <X11/Xlib.h>

class XOSView;


class FieldMeter {
public:
  FieldMeter( XOSView *parent, int x, int y,
	      int width, int height, int numfields,
	      const char *title = "", const char *legend = "", 
	      int dolegends = 0 );
  virtual ~FieldMeter( void );
  
  virtual const char *name( void ) { return "FieldMeter"; }
  void resize( int x, int y, int width, int height );
  void checkevent( void );
  void draw( void );
  void drawfields( void );
  void title( const char *title );
  const char *title( void ) { return title_; }
  void legend( const char *legend );
  const char *legend( void ) { return legend_; }
  void dolegends( int val ) { dolegends_ = val; }
protected:
  XOSView *parent_;
  int x_, y_, width_, height_, numfields_, dolegends_;
  float *fields_, total_;
  float extra_val_;
  char extra_str_[5];
  char *title_, *legend_;
  XColor *colors_;

  void drawlegend( void );
private:
};

#endif
