#ifndef ADS_RAWMSGWIDGET_H_
#define ADS_RAWMSGWIDGET_H_

#include <QSpinBox>

#include "ads_fastslots.h"
#include "ads_manager.h"

class AdsRawSpinBox16: public QSpinBox
{
  Q_OBJECT

public:
  QRegExpValidator *validator;
  //QString defaultIMask;

  int base;
  int cache;

  Ads1553MsgQ** msg;
  int word;

  AdsRawSpinBox16(Ads1553MsgQ** m, int w, QWidget* parent=0);

  void decMode();
  void hexMode(bool h=true);

  virtual QString textFromValue(int value) const;
  virtual int valueFromText(const QString& text) const;
  QValidator::State validate ( QString & input, int & pos ) const;

public slots:
  void setMsgValue(int val);
};

class AdsRawDataView
{
public:
  AdsRawSpinBox16* wRawData[32];
  Ads1553MsgQ* rawCurrentMsg;
  avb_1553_data_buffer_t cache;
  bool force_update;

  void initialize(QWidget* parent);

  ADS_SLOT(onMessageUpdated, (Ads1553MsgQ*));

  void connect(Ads1553MsgQ* m);

  void setHexMode(bool hex);
};

#endif /*ADS_RAWMSGWIDGET_H_*/

