#ifndef TOGGLEBUTTONWIDGET_H
#define TOGGLEBUTTONWIDGET_H


#include "GlobalDefine.h"
#include <QGraphicsWidget>
#include <QRect>
#include <QTimeLine>

#define TOGGLE_BUTTON_ON 1
#define TOGGLE_BUTTON_OFF 0

class CToggleButtonWidget : public QGraphicsWidget
{
	 Q_OBJECT
public:
    CToggleButtonWidget(QString ONImageFilePath, QString OFFImageFilePath,QGraphicsItem *Parent,QString Label = QString());


	virtual void mousePressEvent ( QGraphicsSceneMouseEvent * event );
	virtual void mouseReleaseEvent( QGraphicsSceneMouseEvent * event);
	virtual void resizeEvent(QGraphicsSceneResizeEvent *event);

	QGraphicsPixmapItem *mONPixmap, *mOFFPixmap;

	unsigned int GetButtonState();
	unsigned int SetButtonState(unsigned int State);
    unsigned int SetButtonEnabled(bool Enabled);
	void SetData(unsigned int data);
	unsigned int GetData();

private:
	unsigned int mButtonState;
    bool mButtonEnabled;
	unsigned int mButtonData;

    void UpdateButton();



	signals:
	void ButtonToggled(CToggleButtonWidget*);


};

#endif // TOGGLEBUTTONWIDGET_H
