#ifndef BUTTONPANEL02_H
#define BUTTONPANEL02_H

#include <gobj.h>
#include <point.h>
#include <zprmouse.h>

/*!
\brief Display a panel of 4 buttons.
 
In 2D screen coordinate space.

The buttons are defined in an order where 0 is top, right is 1, 
  down is 2, left is 3.
*/
class buttonpanel02 : public gobj
{
public:

  /** Center as a ratio. */
  point2<double> ratio_center;

  /** Relative to x-axis. */
  double ratio_centerdelta;

  /** Radius of button as a ratio. */
  double ratio_radius;

  /** Convert the ratio values to screen coordinate variables. 
      eg ratio_radius set the radius variable. */
  void update();


  /** Center of button panel in screen coordinates. */
  point2<int> center;

  /** Offset from center for buttons. */
  int centerdelta;

  /** The button's radius in pixels. */
  double radius;

  /** Color corresponds with position. */  
  point3<uint> color[4];

  /** Get button's center position. */
  point2<int> centerpos(uintc i) const;

  /** Constructor. */
  buttonpanel02(zprmouse* zm_);

  /** Conversion programs. */
  zprmouse* zm;

  /** Draw buttons. */
  void draw();

  /** Test if a button was clicked. */
  void process
  (
    bool & isclicked, 
    uint& index, 
    point2<int> const & p
  );

  /** Draws circle at screen coordinates. */
  void drawcircle(point2<int> const & c, point3<uint> const & color) const;

};

#endif


