Subversion Repositories tpanel

Rev

Rev 390 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 390 Rev 391
Line 17... Line 17...
17
 */
17
 */
18
 
18
 
19
#ifndef __TQMARQUEE_H__
19
#ifndef __TQMARQUEE_H__
20
#define __TQMARQUEE_H__
20
#define __TQMARQUEE_H__
21
 
21
 
22
#include <QWidget>
22
#include <QLabel>
23
#include <QStaticText>
-
 
24
#include <QTimer>
23
#include <QTimer>
25
#include <QColor>
-
 
26
 
24
 
27
class QString;
25
class QString;
28
class QPaintEvent;
26
class QPaintEvent;
29
class QStaticText;
27
class QStaticText;
30
class QImage;
28
class QPixmap;
31
class QFont;
29
class QFont;
32
 
30
 
33
class TQMarquee : public QWidget
31
class TQMarquee : public QLabel
34
{
32
{
35
    Q_OBJECT
33
    Q_OBJECT
36
    Q_PROPERTY(QString text READ text WRITE setText)
34
    Q_PROPERTY(QString text READ text WRITE setText)
37
    Q_PROPERTY(QString separator READ separator WRITE setSeparator)
-
 
38
 
35
 
39
    public:
36
    public:
-
 
37
        typedef enum MQ_TYPES
-
 
38
        {
-
 
39
            MQ_NONE,    // 0
-
 
40
            MQ_LEFT,    // 1
-
 
41
            MQ_RIGHT,   // 2
-
 
42
            MQ_PONG,    // 3
-
 
43
            MQ_UP,      // 4
-
 
44
            MQ_DOWN     // 5
-
 
45
        }MQ_TYPES;
-
 
46
 
40
        TQMarquee(QWidget *parent=0);
47
        TQMarquee(QWidget *parent=0);
41
        TQMarquee(QWidget *parent, int msec);
48
        TQMarquee(QWidget *parent, int msec, MQ_TYPES type=MQ_LEFT, bool enable=true);
42
        ~TQMarquee();
49
        ~TQMarquee();
43
 
50
 
-
 
51
        void setAlignment(Qt::Alignment al);
-
 
52
        void setFrame(int left, int top, int right, int bottom);
-
 
53
        void setSpeed(int msec);
-
 
54
        void pause();
-
 
55
        void resume();
-
 
56
 
44
    public slots:
57
    public slots:
45
        QString text() const;
58
        QString text() const { return mText; }
46
        void setText(const QString& text);
59
        void setText(const QString& text);
47
        QString separator() const;
-
 
48
        void setSeparator(const QString& separator);
-
 
49
        QColor backgroundColor();
60
        QColor backgroundColor();
50
        void setBackgroundColor(QColor& color);
61
        void setBackgroundColor(QColor& color);
51
        QImage background();
62
        QPixmap background();
52
        void setBackground(QImage& bitmap);
63
        void setBackground(QPixmap& bitmap);
53
        QFont font();
-
 
54
        void setFont(QFont& f);
64
        void setDirection(MQ_TYPES type);
55
 
65
 
56
    protected:
66
    protected:
57
        virtual void paintEvent(QPaintEvent *);
67
        virtual void paintEvent(QPaintEvent *);
58
        virtual void resizeEvent(QResizeEvent *);
68
        virtual void resizeEvent(QResizeEvent *);
-
 
69
        void updateCoordinates();
59
 
70
 
60
    private slots:
71
    private slots:
61
        virtual void timerTimeout();
72
        void refreshLabel();
62
 
73
 
63
    private:
74
    private:
64
        void init();
75
        void init();
65
        void updateText();
-
 
66
 
76
 
67
        QWidget *mParent{nullptr};
77
        QWidget *mParent{nullptr};
68
        QString mText;
78
        QString mText;
69
        QString mSeparator;
-
 
70
        QStaticText mStaticText;
-
 
71
        int mSingleTextWidth{0};
-
 
72
        QSize mWholeTextSize;
-
 
73
        int mLeftMargin{0};
-
 
74
        bool mScrollEnabled{false};
79
        bool mScrollEnabled{true};
75
        int mScrollPos{0};
-
 
76
        int mSpeed{50};
80
        MQ_TYPES mType{MQ_NONE};
77
        Qt::LayoutDirection mDirection{Qt::RightToLeft};
-
 
78
        QImage mBackgroundImage;
81
        QPixmap mBackgroundImage;
79
        QImage mAlphaChannel;
-
 
80
        QImage mBuffer;
-
 
81
        QColor mBgColor{Qt::transparent};
82
        QColor mBgColor{Qt::transparent};
-
 
83
        int mFrameLeft{0};
-
 
84
        int mFrameTop{0};
-
 
85
        int mFrameRight{0};
-
 
86
        int mFrameBottom{0};
-
 
87
 
-
 
88
        int px{0};
-
 
89
        int py{0};
82
        QTimer mTimer;
90
        QTimer mTimer;
-
 
91
        Qt::Alignment mAlign{Qt::AlignVCenter};
-
 
92
        int mSpeed{200};
-
 
93
        Qt::LayoutDirection mDirection{Qt::LeftToRight};
-
 
94
        int mFontPointSize{8};
-
 
95
        int mTextLength{0};
83
};
96
};
84
 
97
 
85
#endif
98
#endif