#ifndef ATCMSLIDER_H
#define ATCMSLIDER_H

#include <QtGui/QWidget>
#include <QtGui/QSlider>
#include <QLocale>
#ifndef TARGET_ARM
#include <QtDesigner/QDesignerExportWidget>
#endif
#include <QTimer>
#include <QFrame>
#include <QIcon>

class
#ifndef TARGET_ARM
 QDESIGNER_WIDGET_EXPORT
#endif
 ATCMslider : public QSlider
{
	Q_OBJECT
#ifndef TARGET_ARM
		/************* property to hide *************/
        Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet DESIGNABLE false)
        Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled DESIGNABLE false)
        // Q_PROPERTY(QSizePolicy sizePolicy READ sizePolicy WRITE setSizePolicy DESIGNABLE false)
		Q_PROPERTY(bool mouseTracking READ hasMouseTracking WRITE setMouseTracking DESIGNABLE false)
		Q_PROPERTY(QPalette palette READ palette WRITE setPalette DESIGNABLE false)
		Q_PROPERTY(QString toolTip READ toolTip WRITE setToolTip DESIGNABLE false)
		Q_PROPERTY(QCursor cursor READ cursor WRITE setCursor DESIGNABLE false)
		Q_PROPERTY(QString whatsThis READ whatsThis WRITE setWhatsThis DESIGNABLE false)
		Q_PROPERTY(QSize baseSize READ baseSize WRITE setBaseSize DESIGNABLE false)
#ifdef _WIN32
        Q_PROPERTY(QString accessibleName READ accessibleName WRITE setAccessibleName DESIGNABLE false)
		Q_PROPERTY(QString accessibleDescription READ accessibleDescription WRITE setAccessibleDescription DESIGNABLE false)
#endif
		Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection DESIGNABLE false)
		Q_PROPERTY(int sliderPosition READ sliderPosition WRITE setSliderPosition DESIGNABLE false)
		Q_PROPERTY(bool tracking READ hasTracking WRITE setTracking DESIGNABLE false)
		Q_PROPERTY(bool invertedAppearance READ invertedAppearance WRITE setInvertedAppearance DESIGNABLE false)
		Q_PROPERTY(QSize sizeIncrement READ sizeIncrement WRITE setSizeIncrement DESIGNABLE false)
		Q_PROPERTY(Qt::FocusPolicy focusPolicy READ focusPolicy WRITE setFocusPolicy DESIGNABLE false)
		Q_PROPERTY(Qt::ContextMenuPolicy contextMenuPolicy READ contextMenuPolicy WRITE setContextMenuPolicy DESIGNABLE false)
		Q_PROPERTY(bool acceptDrops READ acceptDrops WRITE setAcceptDrops DESIGNABLE false)
		Q_PROPERTY(QString statusTip READ statusTip WRITE setStatusTip DESIGNABLE false)
		Q_PROPERTY(bool autoFillBackground READ autoFillBackground WRITE setAutoFillBackground DESIGNABLE false)
		Q_PROPERTY(QLocale locale READ locale WRITE setLocale DESIGNABLE false)
		Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ inputMethodHints WRITE setInputMethodHints DESIGNABLE false)
        Q_PROPERTY(QFont font READ font WRITE setFont DESIGNABLE false)
        /* hide QSlider property */
        Q_PROPERTY(int tickInterval READ tickInterval DESIGNABLE false)
        Q_PROPERTY(TickPosition tickPosition READ tickPosition DESIGNABLE false)
        /************* new property ************ */
		/* name of the cross table variable associated */
        Q_PROPERTY(QString variable READ variable WRITE setVariable RESET unsetVariable)
		/* refresh time of the crosstable variables */
        Q_PROPERTY(int refresh READ refresh WRITE setRefresh RESET unsetRefresh)
		/* set if the the status of the associated variable have an visible feedback */
        Q_PROPERTY(bool viewStatus READ viewStatus WRITE setViewStatus RESET unsetViewStatus)
		/* set the crosstable variable to associate the button visibility */
        Q_PROPERTY(QString visibilityVar READ visibilityVar WRITE setVisibilityVar RESET unsetVisibilityVar)
		/* set the handler icon */
		Q_PROPERTY(QIcon icon READ icon WRITE setIcon)
		/* set the handler color */
		Q_PROPERTY(QColor handlerColor READ handlerColor WRITE setHandlerColor)
		/* set the sub color */
		Q_PROPERTY(QColor subColor READ subColor WRITE setSubColor)
		/* set the add color */
		Q_PROPERTY(QColor addColor READ addColor WRITE setAddColor)
		/* set the border color */
		Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor)
		/* set the border width */
		Q_PROPERTY(int borderWidth READ borderWidth WRITE setBorderWidth)
		/* set the border radius */
		Q_PROPERTY(int borderRadius READ borderRadius WRITE setBorderRadius)
		/* set the apparence */
        Q_PROPERTY(enum QFrame::Shadow apparence READ apparence WRITE setApparence RESET unsetApparence)
#endif
	public:
		ATCMslider(QWidget *parent = 0);
		~ATCMslider();
		int value()    const { return m_value; }
		QString variable() const { return m_variable; }
		int refresh()      const { return m_refresh; }
		char status()      const { return m_status; }
		bool viewStatus()  const { return m_viewstatus; }
		QString visibilityVar()  const { return m_visibilityvar; }
		int borderWidth()      const { return m_borderwidth; }
		int borderRadius()      const { return m_borderradius; }
		QColor borderColor() const;
		QColor handlerColor() const;
		QIcon icon() const;
		QColor subColor() const;
		QColor addColor() const;

        enum QFrame::Shadow apparence() const;

        bool startAutoReading() const { return true; }
        bool stopAutoReading()  const { return true; }

	public Q_SLOTS:
			bool writeValue(int);
		bool setVariable(QString);
		bool setRefresh(int);
		void setViewStatus(bool);
		bool setVisibilityVar(QString);
		void setIcon(const QIcon& icon);
		void setHandlerColor(const QColor& handlerColor);
		void setSubColor(const QColor& subColor);
		void setAddColor(const QColor& addColor);
		void setBorderColor(const QColor& borderColor);

		void setBorderWidth(int width);
		void setBorderRadius(int radius);

        void setApparence(const enum QFrame::Shadow apparence);

        void unsetVariable();
        void unsetRefresh();
        void unsetViewStatus();
        void unsetVisibilityVar();
        void unsetApparence();

protected Q_SLOTS:
		void updateData();

	protected:
		int m_value;
		QString m_variable;
		QString m_visibilityvar;
		int m_refresh;
		char m_status;
		bool m_viewstatus;
		int m_CtIndex;
		int m_CtVisibilityIndex;
		QColor m_bordercolor;
		QColor m_handlerColor;
		QIcon m_icon;
		QColor m_subColor;
		QColor m_addColor;

		int m_borderwidth;
		int m_borderradius;

        enum QFrame::Shadow m_apparence;

	protected:
		void paintEvent(QPaintEvent *event);

	private:
		QTimer * refresh_timer;
};

#endif
