#ifndef CCTRLLINEEDIT_H
#define CCTRLLINEEDIT_H
#include <QLineEdit>
#include <QWidget>
#include <QDoubleValidator>
#include <QIntValidator>
#include "cmwkeyboard.h"
#include "export_ctrls_common.h"
class CTRLS_COMMON_EXPORT MyDoubleValidator : public QDoubleValidator
{
public:
    MyDoubleValidator(QObject *parent = 0);
    MyDoubleValidator(double bottom, double top, int decimals,
                      QObject *parent = 0);
    QValidator::State validate(QString &s, int &i) const;
 };


class CTRLS_COMMON_EXPORT CCtrlLineEdit : public QLineEdit
{
	Q_OBJECT
public:
    explicit CCtrlLineEdit(QWidget *parent=0);
    explicit CCtrlLineEdit(const QString &s, QWidget* parent=0);
	~CCtrlLineEdit();
	bool m_bNumOnly;
    void focusInEvent(QFocusEvent * event);
    void focusOutEvent(QFocusEvent * event);
    void mouseReleaseEvent(QMouseEvent *event);
    void mousePressEvent(QMouseEvent *event);
    void hideEvent(QHideEvent *);
    void showEvent(QShowEvent *);
    void ShowKeyboard();
    void HideKeyboard();
    void toggleKeyboard();
    MyDoubleValidator m_DValidator;
    QIntValidator m_IValidator;
    void SetRange(double dMin,double dMax,bool bDouble);
    double m_dMax;
    double m_dMin;
    bool m_bDouble;
    bool m_bSetRed;

    QRegExpValidator n_NumValidator;
signals:

public slots:
    void FreshBKColor(const QString& str);
};

extern CCtrlLineEdit* m_gFoucsLineEdit;
#endif // CCTRLLINEEDIT_H
