#ifndef BINWORDEDITOR_H
#define BINWORDEDITOR_H
#include <qvbox.h>
#include <qlineedit.h>
#include "FragBuffer.hh"

class BinWordEditor : public QVBox
{
Q_OBJECT
private:
	unsigned int *word ;
    QLineEdit *val ;
public:
  /**
  \param the memory buffer
  \param index index of edited word
  \param desc decriptor string for this word
  (describe bit fields, name of bit field, and meaning of possible values)
  \param byteAddr not used anymore
  */
	BinWordEditor(FragBuffer& mem, unsigned int index , 
    	const QString& desc, 
		  bool byteAddr, QWidget *parent) ;

  /** parse word descriptor and extract the description of next bit field
  \param desc points to current bit field descriptor.
  This parameter is updated by the function, so, on exit, it points to the
  next descriptor.
  \param name returned name of the decoded descriptor
  \param doc returned documentation associated to descriptor
  \param b1 returned bit number of the first bit of the field
  \param b2 returned bit number of the last bit of the field
  \return true if successful, false if no more field
 */  
	bool parse(const char*& desc,  QString& name, QString& doc , int& b1, int& b2) ;
  /**
  get word value
  \return the value
  */
	unsigned int getValue() ;
  /** Internally used by parse
  \sa parse
  */
  void parseDoc(const char*& p, QString& doc);
signals:
	/** Emmited when the word is changed  */
	void wordChanged() ;
private slots:
	/**  must be activated to synchronize hex display with bit display
  (internal slot)
  */
	void updateHexDisplay() ;
public slots:
	/** must be activated when the word is externally changed */
	void updateDisplay() ;
};

#endif
