#ifndef QSAS_EDITORS_H_
#define QSAS_EDITORS_H_

#include "qt_version.h"
#include <qobject.h>
#include "Qdos.h"
#include "qslot.h"

#if QT_VERSION < 0x040000
#include <qhbox.h>
#include <qgrid.h>
#include <qlayout.h>
#include "QbTimeWidgets.h"
#else
#include <QHBoxLayout>
#include "QbTimeWidgets_qt4.h"
#endif

class argSlider : public QWidget {
  
Q_OBJECT

public:
  argSlider(QString title, int indx, int maxN, QWidget *parent=0, char * name=0 );
  ~argSlider();
  
  QguWLinput *numField;
  int num;
  int maxNum;
  int id;
  
public slots:
  void decRec();
  void incRec();
  void adjustRec();
  
signals:
   void QbEchanged(int id, int num);
   
protected:
  
};


class QbEditor : public Q_V_GROUP_BOX {

Q_OBJECT

public slots:
   void gotInput();
   void updateForRec();

signals:
   void editorHasInput();
   void editorHasTimeInput();
   void saveNow();

public:
  QbEditor(QdObject_var dobj, QWidget *parent=0, const char *name=0 );
  ~QbEditor();
  void setData(QdObject_var dobj);
  void showTimeField(bool OKtoShow);
  void showValueField(bool OKtoShow);
  
#if QT_VERSION < 0x040000
  QHBox * valueBox;
  QHBox * timeBox;
#else
  QWidget * valueBox;
  QWidget * timeBox;
#endif
  QdTimeSeq_var ttags;
  QdObject_var edited_var;

  int record;
  int maxRec;

  QLabel *valueLabel;
  QguWLinput *valueField;
#if QT_VERSION >= 0x040000 && QT_VERSION < 0x040300
  QbDateTimeLineEdit *timeField;
#else
  QbDateTimeWidget *timeField;
#endif

protected:
  QString editorType;
  
};

class QbScalarEditor : public QbEditor {

Q_OBJECT

public slots:
  void valueChanged();
  void timeValueChanged();

signals:
 
public:
  QbScalarEditor(QdObject_var dobj, QWidget *parent=0, const char *name=0 );
  void setData(QdObject_var dobj);
  
  QdRScalar_var S_var;
  
protected:
  
};

class QbScalarSeqEditor : public QbEditor {

Q_OBJECT

public slots:
  void valueChanged();
  void timeValueChanged();

signals:
 
public:
  QbScalarSeqEditor(QdObject_var dobj, QWidget *parent=0, const char *name=0 );
  void setData(QdObject_var dobj);
  void updateForRec();

  QdRScalarSeq_var Sseq_var;
  
protected:
  
};

class QbTtagEditor : public QbEditor {

Q_OBJECT

public slots:
  void valueChanged();

signals:
 
public:
  QbTtagEditor(QdObject_var dobj, QWidget *parent=0, const char *name=0 );
  void setData(QdObject_var dobj);
  void updateForRec();

  QdTimeSeq_var Ttag_var;
  
protected:
  
};


class QbTimeObjEditor : public QbEditor {

Q_OBJECT

public slots:
  void valueChanged();
  void setValue();

signals:
 
public:
  QbTimeObjEditor(QdObject_var dobj, QWidget *parent=0, const char *name=0 );
  void setData(QdObject_var dobj);

  QdTime_var T_var;
  
protected:
  
};

class QbMatrixEditor : public QbEditor {

Q_OBJECT

public slots:
  void valueChanged();
  void timeValueChanged();
  void changeElement(int, int);

signals:
 
public:
  QbMatrixEditor(QdObject_var dobj, QWidget *parent=0, const char *name=0 );
  void setData(QdObject_var dobj);
  
  QdRMatrix_var M_var;
  QdSMatrix_var SM_var;

  int dimSize;  
  vector<int> index;

protected:
  
};

class QbMatrixSeqEditor : public QbEditor {

Q_OBJECT

public slots:
  void valueChanged();
  void timeValueChanged();
  void changeElement(int,int);

signals:
 
public:
  QbMatrixSeqEditor(QdObject_var dobj, QWidget *parent=0, const char *name=0 );
  void setData(QdObject_var dobj);
  void updateForRec();

  QdRMatrixSeq_var Mseq_var;
  QdSMatrixSeq_var SMseq_var;
  
  int dimSize;  
  vector<int> index;
  
protected:
  
};

class QbTextEditor : public QbEditor {

Q_OBJECT

public slots:
  void valueChanged();
  void timeValueChanged();

signals:
 
public:
  QbTextEditor(QdObject_var dobj, QWidget *parent=0, const char *name=0 );
  void setData(QdObject_var dobj);
  
  QdString_var Str_var;
  
protected:
  
};

class QbTextSeqEditor : public QbEditor {

Q_OBJECT

public slots:
  void valueChanged();
  void timeValueChanged();

signals:
 
public:
  QbTextSeqEditor(QdObject_var dobj, QWidget *parent=0, const char *name=0 );
  void setData(QdObject_var dobj);
  void updateForRec();

  QdStringSeq_var Strseq_var;
  
protected:
  
};


# endif // QSAS_EDITORS_H_
