#ifndef QB_TIME_EDITORS_H
#define QB_TIME_EDITORS_H

#include "QbEditors.h"

#include <qobject.h>
#include "qt_version.h"
#if QT_VERSION < 0x040000
#include "qstatusbar.h"
#else
#include <QStatusBar>
#endif

class QbTimeIntervalEditor:public QbEditor
{
	Q_OBJECT
			
	public:
		QbTimeIntervalEditor( QdObject_var dobj, QWidget *parent=0, const char *name=0 );
		QdTimeInterval_var _time_interval_var;
		
		virtual void save(Vostream&);
		virtual void restore(Vistream&);
		
		void set_time_interval(const QDOS::TimeInterval& tintv);

		bool get_time_interval( QDOS::TimeInterval& tintv ) const;

		QDOS::Time get_duration();
		
	public slots:
		
		void setData(QdObject_var dobj);
		
		void updateTI();
	
	signals:
		void time_updated(); // used only in DataSelector, in a strange way. TODO remove when DS has been cleaned up
		
	protected:
		QbTimeIntervalWidget * interval_edit;
	
};

class QbEventTableEditor:public QbEditor
{
	Q_OBJECT
			
	public:
		QbEventTableEditor( QdObject_var dobj, QWidget *parent=0, const char *name=0 );
		
		QdTimeIntervalSeq_var _event_table_var;
		
		void set_event_table(const QdTimeIntervalSeq& evttbl);

		bool get_time_interval( QDOS::TimeInterval& tintv ) const;

		QDOS::Time get_duration();
		
	public slots:
		
		void setData(QdObject_var dobj);
		
		void updateCurrentTI();
		
		void updateForRec();
	
	signals:
		
	protected:
		QbTimeIntervalWidget * interval_edit;
	
};

class QbuLineEdit:public QLineEdit{
	Q_OBJECT
	public:
		QbuLineEdit(QWidget* parent=0,const char* name=0):\
				QLineEdit(parent,name){;}
 
	protected:
		QString _old_text;
		void focusOutEvent(QFocusEvent *e);

	public slots:
		void setText(const QString& txt)
		{ _old_text=text(); QLineEdit::setText(txt);}
	signals:
		void focusOut();

};


#endif
